[vlc-commits] os2: fix one instance mode

KO Myung-Hun git at videolan.org
Sat Feb 22 10:56:12 CET 2014


vlc | branch: master | KO Myung-Hun <komh78 at gmail.com> | Sat Feb 22 14:58:09 2014 +0900| [adc609524038975e0874ccd11a5f15de0523875c] | committer: Jean-Baptiste Kempf

os2: fix one instance mode

Files are not added, and a first instance is blocked.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=adc609524038975e0874ccd11a5f15de0523875c
---

 src/os2/specific.c |   38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/os2/specific.c b/src/os2/specific.c
index e772f2e..fde5514 100644
--- a/src/os2/specific.c
+++ b/src/os2/specific.c
@@ -45,7 +45,7 @@ static int   tidIPCHelper = -1;
 
 static void IPCHelperThread( void *arg )
 {
-    vlc_object_t *p_this = arg;
+    libvlc_int_t *libvlc = arg;
 
     ULONG  ulCmd;
     int    i_argc;
@@ -55,7 +55,7 @@ static void IPCHelperThread( void *arg )
     int    i_options;
 
     /* Add files to the playlist */
-    playlist_t *p_playlist = pl_Get( p_this );
+    playlist_t *p_playlist;
 
     do
     {
@@ -82,6 +82,8 @@ static void IPCHelperThread( void *arg )
             DosRead( hpipeIPC, ppsz_argv[ i_opt ], i_len, &cbActual );
         }
 
+        p_playlist = libvlc_priv(libvlc)->playlist;
+
         for( int i_opt = 0; i_opt < i_argc;)
         {
             i_options = 0;
@@ -91,16 +93,20 @@ static void IPCHelperThread( void *arg )
                    *ppsz_argv[ i_opt + i_options + 1 ] == ':' )
                 i_options++;
 
-            playlist_AddExt( p_playlist, ppsz_argv[ i_opt ], NULL,
-                             PLAYLIST_APPEND |
-                             (( i_opt || ulCmd == IPC_CMD_ENQUEUE ) ?
-                                    0 : PLAYLIST_GO ),
-                             PLAYLIST_END, -1, i_options,
-                             ( char const ** )
-                                 ( i_options ? &ppsz_argv[ i_opt + 1 ] :
-                                               NULL ),
-                             VLC_INPUT_OPTION_TRUSTED,
-                             true, pl_Unlocked );
+
+            if( p_playlist )
+            {
+                playlist_AddExt( p_playlist, ppsz_argv[ i_opt ], NULL,
+                                 PLAYLIST_APPEND |
+                                 (( i_opt || ulCmd == IPC_CMD_ENQUEUE ) ?
+                                     0 : PLAYLIST_GO ),
+                                 PLAYLIST_END, -1, i_options,
+                                 ( char const ** )
+                                     ( i_options ? &ppsz_argv[ i_opt + 1 ] :
+                                                   NULL ),
+                                 VLC_INPUT_OPTION_TRUSTED,
+                                 true, pl_Unlocked );
+            }
 
             for( ; i_options >= 0; i_options-- )
                 free( ppsz_argv[ i_opt++ ]);
@@ -109,8 +115,6 @@ static void IPCHelperThread( void *arg )
         free( ppsz_argv );
     } while( !DosDisConnectNPipe( hpipeIPC ) && ulCmd != IPC_CMD_QUIT );
 
-    vlc_object_release( p_this );
-
     DosClose( hpipeIPC );
     hpipeIPC = NULLHANDLE;
 
@@ -181,21 +185,17 @@ void system_Configure( libvlc_int_t *p_this, int i_argc, const char *const ppsz_
             }
 
             /* We are the 1st instance. */
-            vlc_object_t* p_helper = vlc_custom_create( p_this,
-                                                        sizeof( *p_helper ),
-                                                        "ipc helper" );
 
             /* Save the tid of the first instance */
             tidIPCFirst = _gettid();
 
             /* Run the helper thread */
             tidIPCHelper = _beginthread( IPCHelperThread, NULL, 1024 * 1024,
-                                         p_helper );
+                                         p_this );
             if( tidIPCHelper == -1 )
             {
                 msg_Err( p_this, "one instance mode DISABLED "
                          "(IPC helper thread couldn't be created)");
-                vlc_object_release( p_helper );
 
                 tidIPCFirst = -1;
             }



More information about the vlc-commits mailing list