]> git.sesse.net Git - vlc/blobdiff - src/win32/specific.c
Remove useless vlc_object_detach() before vlc_object_release()
[vlc] / src / win32 / specific.c
index bf131fbbbccab5e847282273ce508051f29a9197..85fcc0380e19d7a3beda0760e7e77402264c4dc3 100644 (file)
@@ -310,7 +310,11 @@ static unsigned __stdcall IPCHelperThread( void *data )
 LRESULT CALLBACK WMCOPYWNDPROC( HWND hwnd, UINT uMsg, WPARAM wParam,
                                 LPARAM lParam )
 {
-    if( uMsg == WM_COPYDATA )
+    if( uMsg == WM_QUIT  )
+    {
+        PostQuitMessage( 0 );
+    }
+    else if( uMsg == WM_COPYDATA )
     {
         COPYDATASTRUCT *pwm_data = (COPYDATASTRUCT*)lParam;
         vlc_object_t *p_this;
@@ -382,15 +386,17 @@ void system_End( libvlc_int_t *p_this )
         psz_vlcpath = NULL;
     }
 
-    if( ( ipcwindow = FindWindow( 0, L"VLC ipc "VERSION ) ) != 0 )
-    {
-        SendMessage( ipcwindow, WM_QUIT, 0, 0 );
-    }
-
     if (p_helper && p_helper->p_parent == VLC_OBJECT(p_this) )
     {
+        /* this is the first instance (in a one-instance system)
+         * it is the owner of the helper thread
+         */
+        if( ( ipcwindow = FindWindow( 0, L"VLC ipc "VERSION ) ) != 0 )
+        {
+            SendMessage( ipcwindow, WM_QUIT, 0, 0 );
+        }
+
         /* FIXME: thread-safety... */
-        vlc_object_detach (p_helper);
         vlc_object_release (p_helper);
         p_helper = NULL;
     }