Commit adc60952 authored by KO Myung-Hun's avatar KO Myung-Hun Committed by Jean-Baptiste Kempf

os2: fix one instance mode

Files are not added, and a first instance is blocked.
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent fc5a99b9
...@@ -45,7 +45,7 @@ static int tidIPCHelper = -1; ...@@ -45,7 +45,7 @@ static int tidIPCHelper = -1;
static void IPCHelperThread( void *arg ) static void IPCHelperThread( void *arg )
{ {
vlc_object_t *p_this = arg; libvlc_int_t *libvlc = arg;
ULONG ulCmd; ULONG ulCmd;
int i_argc; int i_argc;
...@@ -55,7 +55,7 @@ static void IPCHelperThread( void *arg ) ...@@ -55,7 +55,7 @@ static void IPCHelperThread( void *arg )
int i_options; int i_options;
/* Add files to the playlist */ /* Add files to the playlist */
playlist_t *p_playlist = pl_Get( p_this ); playlist_t *p_playlist;
do do
{ {
...@@ -82,6 +82,8 @@ static void IPCHelperThread( void *arg ) ...@@ -82,6 +82,8 @@ static void IPCHelperThread( void *arg )
DosRead( hpipeIPC, ppsz_argv[ i_opt ], i_len, &cbActual ); DosRead( hpipeIPC, ppsz_argv[ i_opt ], i_len, &cbActual );
} }
p_playlist = libvlc_priv(libvlc)->playlist;
for( int i_opt = 0; i_opt < i_argc;) for( int i_opt = 0; i_opt < i_argc;)
{ {
i_options = 0; i_options = 0;
...@@ -91,6 +93,9 @@ static void IPCHelperThread( void *arg ) ...@@ -91,6 +93,9 @@ static void IPCHelperThread( void *arg )
*ppsz_argv[ i_opt + i_options + 1 ] == ':' ) *ppsz_argv[ i_opt + i_options + 1 ] == ':' )
i_options++; i_options++;
if( p_playlist )
{
playlist_AddExt( p_playlist, ppsz_argv[ i_opt ], NULL, playlist_AddExt( p_playlist, ppsz_argv[ i_opt ], NULL,
PLAYLIST_APPEND | PLAYLIST_APPEND |
(( i_opt || ulCmd == IPC_CMD_ENQUEUE ) ? (( i_opt || ulCmd == IPC_CMD_ENQUEUE ) ?
...@@ -101,6 +106,7 @@ static void IPCHelperThread( void *arg ) ...@@ -101,6 +106,7 @@ static void IPCHelperThread( void *arg )
NULL ), NULL ),
VLC_INPUT_OPTION_TRUSTED, VLC_INPUT_OPTION_TRUSTED,
true, pl_Unlocked ); true, pl_Unlocked );
}
for( ; i_options >= 0; i_options-- ) for( ; i_options >= 0; i_options-- )
free( ppsz_argv[ i_opt++ ]); free( ppsz_argv[ i_opt++ ]);
...@@ -109,8 +115,6 @@ static void IPCHelperThread( void *arg ) ...@@ -109,8 +115,6 @@ static void IPCHelperThread( void *arg )
free( ppsz_argv ); free( ppsz_argv );
} while( !DosDisConnectNPipe( hpipeIPC ) && ulCmd != IPC_CMD_QUIT ); } while( !DosDisConnectNPipe( hpipeIPC ) && ulCmd != IPC_CMD_QUIT );
vlc_object_release( p_this );
DosClose( hpipeIPC ); DosClose( hpipeIPC );
hpipeIPC = NULLHANDLE; hpipeIPC = NULLHANDLE;
...@@ -181,21 +185,17 @@ void system_Configure( libvlc_int_t *p_this, int i_argc, const char *const ppsz_ ...@@ -181,21 +185,17 @@ void system_Configure( libvlc_int_t *p_this, int i_argc, const char *const ppsz_
} }
/* We are the 1st instance. */ /* 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 */ /* Save the tid of the first instance */
tidIPCFirst = _gettid(); tidIPCFirst = _gettid();
/* Run the helper thread */ /* Run the helper thread */
tidIPCHelper = _beginthread( IPCHelperThread, NULL, 1024 * 1024, tidIPCHelper = _beginthread( IPCHelperThread, NULL, 1024 * 1024,
p_helper ); p_this );
if( tidIPCHelper == -1 ) if( tidIPCHelper == -1 )
{ {
msg_Err( p_this, "one instance mode DISABLED " msg_Err( p_this, "one instance mode DISABLED "
"(IPC helper thread couldn't be created)"); "(IPC helper thread couldn't be created)");
vlc_object_release( p_helper );
tidIPCFirst = -1; tidIPCFirst = -1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment