Commit 4bd96e38 authored by Erwan Tulou's avatar Erwan Tulou Committed by Jean-Baptiste Kempf

skins2: don't stop the whole vlc instance when skins2 fails to initialize

This closes #6064
(cherry picked from commit 7c693f065ba6866575f8db8a45156d2f370f848c)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 9b15c783
...@@ -142,6 +142,7 @@ struct intf_sys_t ...@@ -142,6 +142,7 @@ struct intf_sys_t
vlc_thread_t thread; vlc_thread_t thread;
vlc_mutex_t init_lock; vlc_mutex_t init_lock;
vlc_cond_t init_wait; vlc_cond_t init_wait;
bool b_error;
bool b_ready; bool b_ready;
}; };
......
...@@ -108,6 +108,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -108,6 +108,7 @@ static int Open( vlc_object_t *p_this )
vlc_cond_init( &p_intf->p_sys->init_wait ); vlc_cond_init( &p_intf->p_sys->init_wait );
vlc_mutex_lock( &p_intf->p_sys->init_lock ); vlc_mutex_lock( &p_intf->p_sys->init_lock );
p_intf->p_sys->b_error = false;
p_intf->p_sys->b_ready = false; p_intf->p_sys->b_ready = false;
if( vlc_clone( &p_intf->p_sys->thread, Run, p_intf, if( vlc_clone( &p_intf->p_sys->thread, Run, p_intf,
...@@ -125,6 +126,17 @@ static int Open( vlc_object_t *p_this ) ...@@ -125,6 +126,17 @@ static int Open( vlc_object_t *p_this )
vlc_cond_wait( &p_intf->p_sys->init_wait, &p_intf->p_sys->init_lock ); vlc_cond_wait( &p_intf->p_sys->init_wait, &p_intf->p_sys->init_lock );
vlc_mutex_unlock( &p_intf->p_sys->init_lock ); vlc_mutex_unlock( &p_intf->p_sys->init_lock );
if( p_intf->p_sys->b_error )
{
vlc_join( p_intf->p_sys->thread, NULL );
vlc_mutex_destroy( &p_intf->p_sys->init_lock );
vlc_cond_destroy( &p_intf->p_sys->init_wait );
free( p_intf->p_sys );
return VLC_EGENERIC;
}
vlc_mutex_lock( &skin_load.mutex ); vlc_mutex_lock( &skin_load.mutex );
skin_load.intf = p_intf; skin_load.intf = p_intf;
vlc_mutex_unlock( &skin_load.mutex ); vlc_mutex_unlock( &skin_load.mutex );
...@@ -252,6 +264,7 @@ static void *Run( void * p_obj ) ...@@ -252,6 +264,7 @@ static void *Run( void * p_obj )
loop = OSFactory::instance( p_intf )->getOSLoop(); loop = OSFactory::instance( p_intf )->getOSLoop();
// Signal the main thread this thread is now ready // Signal the main thread this thread is now ready
p_intf->p_sys->b_error = false;
p_intf->p_sys->b_ready = true; p_intf->p_sys->b_ready = true;
vlc_cond_signal( &p_intf->p_sys->init_wait ); vlc_cond_signal( &p_intf->p_sys->init_wait );
vlc_mutex_unlock( &p_intf->p_sys->init_lock ); vlc_mutex_unlock( &p_intf->p_sys->init_lock );
...@@ -290,11 +303,10 @@ end: ...@@ -290,11 +303,10 @@ end:
if( b_error ) if( b_error )
{ {
p_intf->p_sys->b_error = true;
p_intf->p_sys->b_ready = true; p_intf->p_sys->b_ready = true;
vlc_cond_signal( &p_intf->p_sys->init_wait ); vlc_cond_signal( &p_intf->p_sys->init_wait );
vlc_mutex_unlock( &p_intf->p_sys->init_lock ); vlc_mutex_unlock( &p_intf->p_sys->init_lock );
libvlc_Quit( p_intf->p_libvlc );
} }
vlc_restorecancel(canc); vlc_restorecancel(canc);
......
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