[vlc-commits] qt4: singleton: Use vlc_mutex_locker instead of manual lock/unlock

Hugo Beauzée-Luyssen git at videolan.org
Thu Dec 10 18:24:34 CET 2015


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Thu Dec 10 17:43:21 2015 +0100| [ae24f549e78654ac9501d5275139e5ebe5d28eb1] | committer: Hugo Beauzée-Luyssen

qt4: singleton: Use vlc_mutex_locker instead of manual lock/unlock

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

 modules/gui/qt4/util/singleton.hpp |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/modules/gui/qt4/util/singleton.hpp b/modules/gui/qt4/util/singleton.hpp
index c27e635..76144bb 100644
--- a/modules/gui/qt4/util/singleton.hpp
+++ b/modules/gui/qt4/util/singleton.hpp
@@ -34,22 +34,20 @@ class       Singleton
 public:
     static T*      getInstance( intf_thread_t *p_intf = NULL )
     {
-        vlc_mutex_lock( &m_mutex );
+        vlc_mutex_locker lock( &m_mutex );
         if ( m_instance == NULL )
             m_instance = new T( p_intf );
-        vlc_mutex_unlock( &m_mutex );
         return m_instance;
     }
 
     static void    killInstance()
     {
-        vlc_mutex_lock( &m_mutex );
+        vlc_mutex_locker lock( &m_mutex );
         if ( m_instance != NULL )
         {
             delete m_instance;
             m_instance = NULL;
         }
-        vlc_mutex_unlock( &m_mutex );
     }
 protected:
     Singleton(){}



More information about the vlc-commits mailing list