[vlc-commits] skins2: don't stop the whole vlc instance when skins2 fails to initialize

Erwan Tulou git at videolan.org
Fri Feb 17 15:34:50 CET 2012


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Fri Feb 17 14:57:57 2012 +0100| [7c693f065ba6866575f8db8a45156d2f370f848c] | committer: Erwan Tulou

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

This closes #6064

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

 modules/gui/skins2/src/skin_common.hpp |    1 +
 modules/gui/skins2/src/skin_main.cpp   |   16 ++++++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/modules/gui/skins2/src/skin_common.hpp b/modules/gui/skins2/src/skin_common.hpp
index e992bd8..b7addbe 100644
--- a/modules/gui/skins2/src/skin_common.hpp
+++ b/modules/gui/skins2/src/skin_common.hpp
@@ -142,6 +142,7 @@ struct intf_sys_t
     vlc_thread_t thread;
     vlc_mutex_t  init_lock;
     vlc_cond_t   init_wait;
+    bool         b_error;
     bool         b_ready;
 };
 
diff --git a/modules/gui/skins2/src/skin_main.cpp b/modules/gui/skins2/src/skin_main.cpp
index 8d0dceb..095bf49 100644
--- a/modules/gui/skins2/src/skin_main.cpp
+++ b/modules/gui/skins2/src/skin_main.cpp
@@ -108,6 +108,7 @@ static int Open( vlc_object_t *p_this )
     vlc_cond_init( &p_intf->p_sys->init_wait );
 
     vlc_mutex_lock( &p_intf->p_sys->init_lock );
+    p_intf->p_sys->b_error = false;
     p_intf->p_sys->b_ready = false;
 
     if( vlc_clone( &p_intf->p_sys->thread, Run, p_intf,
@@ -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_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 );
     skin_load.intf = p_intf;
     vlc_mutex_unlock( &skin_load.mutex );
@@ -252,6 +264,7 @@ static void *Run( void * p_obj )
     loop = OSFactory::instance( p_intf )->getOSLoop();
 
     // Signal the main thread this thread is now ready
+    p_intf->p_sys->b_error = false;
     p_intf->p_sys->b_ready = true;
     vlc_cond_signal( &p_intf->p_sys->init_wait );
     vlc_mutex_unlock( &p_intf->p_sys->init_lock );
@@ -290,11 +303,10 @@ end:
 
     if( b_error )
     {
+        p_intf->p_sys->b_error = true;
         p_intf->p_sys->b_ready = true;
         vlc_cond_signal( &p_intf->p_sys->init_wait );
         vlc_mutex_unlock( &p_intf->p_sys->init_lock );
-
-        libvlc_Quit( p_intf->p_libvlc );
     }
 
     vlc_restorecancel(canc);



More information about the vlc-commits mailing list