From de22c7581d4a0c2e12c7daae9633f1828b46ea4c Mon Sep 17 00:00:00 2001 From: Cyril Deguet Date: Sun, 25 Jan 2004 13:59:33 +0000 Subject: [PATCH] * all: fixed segfaults when initialization fails --- modules/gui/skins2/src/skin_main.cpp | 12 ++++++------ modules/gui/skins2/x11/x11_display.cpp | 17 ++++++++++------- modules/gui/skins2/x11/x11_factory.cpp | 5 +++-- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/modules/gui/skins2/src/skin_main.cpp b/modules/gui/skins2/src/skin_main.cpp index 69941a6fe6..48ab7620f5 100644 --- a/modules/gui/skins2/src/skin_main.cpp +++ b/modules/gui/skins2/src/skin_main.cpp @@ -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 * Olivier Teulière @@ -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" ); diff --git a/modules/gui/skins2/x11/x11_display.cpp b/modules/gui/skins2/x11/x11_display.cpp index e1eac7e869..8a180fc318 100644 --- a/modules/gui/skins2/x11/x11_display.cpp +++ b/modules/gui/skins2/x11/x11_display.cpp @@ -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 * Olivier Teulière @@ -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 ); + } } diff --git a/modules/gui/skins2/x11/x11_factory.cpp b/modules/gui/skins2/x11/x11_factory.cpp index 3c6502856d..ac3473aa8a 100644 --- a/modules/gui/skins2/x11/x11_factory.cpp +++ b/modules/gui/skins2/x11/x11_factory.cpp @@ -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 * Olivier Teulière @@ -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() } -- 2.39.2