diff options
author | Michael Meeks <michael.meeks@suse.com> | 2011-10-26 12:39:08 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2011-10-26 12:39:08 +0100 |
commit | 91cd2b8e7647d7d6d81e6a3e43e1aef08b3f0b7c (patch) | |
tree | a0b67bb1e77d86293313fb02114c76de3d7da52b /vcl/unx/generic/app | |
parent | 273a15e4903e6ea21de77c238ab769361f2fc84f (diff) |
generic: cleanup vcl / X11 display abstraction to fix crasher
Thanks to sberg for the pointer.
Diffstat (limited to 'vcl/unx/generic/app')
-rw-r--r-- | vcl/unx/generic/app/saldata.cxx | 6 | ||||
-rw-r--r-- | vcl/unx/generic/app/saldisp.cxx | 20 |
2 files changed, 16 insertions, 10 deletions
diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx index 8eb660202483..93d5ea6cf8b4 100644 --- a/vcl/unx/generic/app/saldata.cxx +++ b/vcl/unx/generic/app/saldata.cxx @@ -94,10 +94,14 @@ X11SalData* GetX11SalData() { SalData * p1 = ImplGetSVData()->mpSalData; - OSL_ASSERT(p1 != 0); + +#if OSL_DEBUG_LEVEL > 0 X11SalData * p2 = dynamic_cast< X11SalData * >(p1); OSL_ASSERT(p2 != 0); return p2; +#else + return (X11SalData *) p1; +#endif } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx index 515f43381c60..74c4ef76396f 100644 --- a/vcl/unx/generic/app/saldisp.cxx +++ b/vcl/unx/generic/app/saldisp.cxx @@ -496,15 +496,15 @@ SalDisplay::SalDisplay( Display *display ) : #endif SalGenericData *pData = GetGenericData(); + pXLib_ = NULL; DBG_ASSERT( ! pData->GetDisplay(), "Second SalDisplay created !!!\n" ); pData->SetDisplay( this ); - pXLib_ = GetX11SalData()->GetLib(); m_nDefaultScreen = DefaultScreen( pDisp_ ); } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -SalDisplay::~SalDisplay( ) +SalDisplay::~SalDisplay() { #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "SalDisplay::~SalDisplay()\n" ); @@ -562,7 +562,8 @@ void SalDisplay::doDestruct() XFreeCursor( pDisp_, aPointerCache_[i] ); } - pXLib_->Remove( ConnectionNumber( pDisp_ ) ); + if( pXLib_ ) + pXLib_->Remove( ConnectionNumber( pDisp_ ) ); } if( pData->GetDisplay() == static_cast<const SalGenericDisplay *>( this ) ) @@ -615,6 +616,7 @@ SalX11Display::SalX11Display( Display *display ) { Init(); + pXLib_ = GetX11SalData()->GetLib(); pXLib_->Insert( ConnectionNumber( pDisp_ ), this, (YieldFunc) DisplayHasEvent, @@ -635,6 +637,12 @@ SalX11Display::~SalX11Display() } } +void SalX11Display::PostUserEvent() +{ + if( pXLib_ ) + pXLib_->PostUserEvent(); +} + void SalDisplay::initScreen( int nScreen ) const { if( nScreen < 0 || nScreen >= static_cast<int>(m_aScreens.size()) ) @@ -3158,10 +3166,4 @@ Pixel SalColormap::GetPixel( SalColor nSalColor ) const + ((b+8)/17) ]; } -void SalDisplay::PostUserEvent() -{ - if( pXLib_ ) - pXLib_->PostUserEvent(); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |