[vlc-commits] Win32(core): do not duplicate handle
Erwan Tulou
git at videolan.org
Wed Jun 8 18:08:12 CEST 2011
vlc/vlc-1.1 | branch: master | Erwan Tulou <erwan10 at videolan.org> | Wed Feb 10 13:19:42 2010 +0100| [0fada6d7076e7229e01eb037de6b06fbb05f481a] | committer: Rémi Denis-Courmont
Win32(core): do not duplicate handle
Unlike _endthread and ExitThread, _endthreadex doesn't close the handle.
It is therefore up to the caller to close it. Hence no need for an extra
handle duplication (that mostly amounted to a memory leak when the normal
path was used, i.e normal return from thread with implicit _endthreadex)
(cherry picked from commit afe774e0b19c7dcad8d0ae248480df1b0660a380)
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=0fada6d7076e7229e01eb037de6b06fbb05f481a
---
src/win32/thread.c | 10 +---------
1 files changed, 1 insertions(+), 9 deletions(-)
diff --git a/src/win32/thread.c b/src/win32/thread.c
index b2e939d..1d25b90 100644
--- a/src/win32/thread.c
+++ b/src/win32/thread.c
@@ -553,15 +553,7 @@ int vlc_clone (vlc_thread_t *p_handle, void * (*entry) (void *), void *data,
goto error;
}
- /* Thread closes the handle when exiting, duplicate it here
- * to be on the safe side when joining. */
- if (!DuplicateHandle (GetCurrentProcess (), hThread,
- GetCurrentProcess (), p_handle, 0, FALSE,
- DUPLICATE_SAME_ACCESS))
- {
- CloseHandle (hThread);
- goto error;
- }
+ *p_handle = hThread;
#else
vlc_thread_t th = malloc (sizeof (*th));
More information about the vlc-commits
mailing list