]> git.sesse.net Git - vlc/blobdiff - src/misc/win32_specific.c
Added a missing lock around attachments.
[vlc] / src / misc / win32_specific.c
index 5de59a5f718999d1523628a9a642d2f8ec2904d5..a596502a0a5fb3f7c328fc645e74aee592718c65 100644 (file)
@@ -76,7 +76,7 @@ void system_Init( libvlc_int_t *p_this, int *pi_argc, const char *ppsz_argv[] )
     }
 #endif
 
-    vlc_global()->psz_vlcpath = strdup( psz_path );
+    psz_vlcpath = strdup( psz_path );
 
     /* Set the default file-translation mode */
 #if !defined( UNDER_CE )
@@ -130,7 +130,7 @@ typedef struct
 {
   int argc;
   int enqueue;
-  char data[0];
+  char data[];
 } vlc_ipc_data_t;
 
 void system_Configure( libvlc_int_t *p_this, int *pi_argc, const char *ppsz_argv[] )
@@ -317,7 +317,7 @@ LRESULT CALLBACK WMCOPYWNDPROC( HWND hwnd, UINT uMsg, WPARAM wParam,
         if( !p_this ) return 0;
 
         /* Add files to the playlist */
-        p_playlist = pl_Yield( p_this );
+        p_playlist = pl_Hold( p_this );
         if( !p_playlist ) return 0;
 
         if( pwm_data->lpData )
@@ -348,8 +348,10 @@ LRESULT CALLBACK WMCOPYWNDPROC( HWND hwnd, UINT uMsg, WPARAM wParam,
                   NULL, PLAYLIST_APPEND |
                         ( ( i_opt || p_data->enqueue ) ? 0 : PLAYLIST_GO ),
                   PLAYLIST_END, -1,
+                  i_options,
                   (char const **)( i_options ? &ppsz_argv[i_opt+1] : NULL ),
-                  i_options, true, pl_Unlocked );
+                  VLC_INPUT_OPTION_TRUSTED,
+                  true, pl_Unlocked );
 
                 i_opt += i_options;
             }
@@ -368,16 +370,21 @@ LRESULT CALLBACK WMCOPYWNDPROC( HWND hwnd, UINT uMsg, WPARAM wParam,
  *****************************************************************************/
 void system_End( libvlc_int_t *p_this )
 {
-    if( p_this && vlc_global() )
+    HWND ipcwindow;
+    if( p_this )
     {
-        free( vlc_global()->psz_vlcpath );
-        vlc_global()->psz_vlcpath = NULL;
+        free( psz_vlcpath );
+        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) )
     {
         /* FIXME: thread-safety... */
-        SendMessage( NULL, WM_QUIT, 0, 0 );
-        vlc_thread_join (p_helper);
         vlc_object_detach (p_helper);
         vlc_object_release (p_helper);
         p_helper = NULL;