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: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent fc5a99b9
......@@ -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;
}
......
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