]> git.sesse.net Git - vlc/commitdiff
* all: fixed segfaults when initialization fails
authorCyril Deguet <asmax@videolan.org>
Sun, 25 Jan 2004 13:59:33 +0000 (13:59 +0000)
committerCyril Deguet <asmax@videolan.org>
Sun, 25 Jan 2004 13:59:33 +0000 (13:59 +0000)
modules/gui/skins2/src/skin_main.cpp
modules/gui/skins2/x11/x11_display.cpp
modules/gui/skins2/x11/x11_factory.cpp

index 69941a6fe627337bf32dfbd6b069c1496ecc10fe..48ab7620f55927c4082b45fa9c1c684302f19f8e 100644 (file)
@@ -2,7 +2,7 @@
  * skin_main.cpp
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: skin_main.cpp,v 1.2 2004/01/11 17:12:17 asmax Exp $
+ * $Id: skin_main.cpp,v 1.3 2004/01/25 13:59:33 asmax Exp $
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
  *          Olivier Teulière <ipkiss@via.ecp.fr>
@@ -96,6 +96,11 @@ static int Open( vlc_object_t *p_this )
     p_intf->p_sys->p_theme = NULL;
 
     // Initialize singletons
+    if( OSFactory::instance( p_intf ) == NULL )
+    {
+        msg_Err( p_intf, "Cannot initialize OSFactory" );
+        return VLC_EGENERIC;
+    }
     if( AsyncQueue::instance( p_intf ) == NULL )
     {
         msg_Err( p_intf, "Cannot initialize AsyncQueue" );
@@ -106,11 +111,6 @@ static int Open( vlc_object_t *p_this )
         msg_Err( p_intf, "Cannot instanciate Interpreter" );
         return VLC_EGENERIC;
     }
-    if( OSFactory::instance( p_intf ) == NULL )
-    {
-        msg_Err( p_intf, "Cannot initialize OSFactory" );
-        return VLC_EGENERIC;
-    }
     if( VarManager::instance( p_intf ) == NULL )
     {
         msg_Err( p_intf, "Cannot instanciate VarManager" );
index e1eac7e8695b166d5578d925e168a165bf3e43de..8a180fc318ee62bdf436193d7e1c6f804b04cfaf 100644 (file)
@@ -2,7 +2,7 @@
  * x11_display.cpp
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: x11_display.cpp,v 1.1 2004/01/03 23:31:34 asmax Exp $
+ * $Id: x11_display.cpp,v 1.2 2004/01/25 13:59:33 asmax Exp $
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
  *          Olivier Teulière <ipkiss@via.ecp.fr>
@@ -51,12 +51,6 @@ X11Display::X11Display( intf_thread_t *pIntf ): SkinObject( pIntf ),
     int depth = DefaultDepth( m_pDisplay, screen );
     int order = ImageByteOrder( m_pDisplay );
 
-    // Create a graphics context that doesn't generate GraphicsExpose events
-    XGCValues xgcvalues;
-    xgcvalues.graphics_exposures = False;
-    m_gc = XCreateGC( m_pDisplay, DefaultRootWindow( m_pDisplay ),
-                      GCGraphicsExposures, &xgcvalues );
-
     // Template for looking up the XVisualInfo
     XVisualInfo xVInfoTemplate;
     xVInfoTemplate.screen = screen;
@@ -127,6 +121,15 @@ X11Display::X11Display( intf_thread_t *pIntf ): SkinObject( pIntf ),
     {
         XFree( pVInfo );
     }
+
+    // Create a graphics context that doesn't generate GraphicsExpose events
+    if( m_pDisplay )
+    {
+        XGCValues xgcvalues;
+        xgcvalues.graphics_exposures = False;
+        m_gc = XCreateGC( m_pDisplay, DefaultRootWindow( m_pDisplay ),
+                          GCGraphicsExposures, &xgcvalues );
+    }
 }
 
 
index 3c6502856d448ec1f0ed1c617d6787bc0fcdd4a6..ac3473aa8aa74d8ce40ef8f56caa158d5e35de6a 100644 (file)
@@ -2,7 +2,7 @@
  * x11_factory.cpp
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: x11_factory.cpp,v 1.1 2004/01/03 23:31:34 asmax Exp $
+ * $Id: x11_factory.cpp,v 1.2 2004/01/25 13:59:33 asmax Exp $
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
  *          Olivier Teulière <ipkiss@via.ecp.fr>
@@ -38,7 +38,8 @@
 #include "x11_tooltip.hpp"
 
 
-X11Factory::X11Factory( intf_thread_t *pIntf ): OSFactory( pIntf )
+X11Factory::X11Factory( intf_thread_t *pIntf ): OSFactory( pIntf ),
+    m_pDisplay( NULL ), m_pTimerLoop( NULL )
 {
     // see init()
 }