[Libreoffice-commits] .: vcl/inc vcl/unx
Michael Meeks
michael at kemper.freedesktop.org
Wed Oct 26 04:40:18 PDT 2011
vcl/inc/unx/saldisp.hxx | 4 +++-
vcl/unx/generic/app/saldata.cxx | 6 +++++-
vcl/unx/generic/app/saldisp.cxx | 20 +++++++++++---------
3 files changed, 19 insertions(+), 11 deletions(-)
New commits:
commit 91cd2b8e7647d7d6d81e6a3e43e1aef08b3f0b7c
Author: Michael Meeks <michael.meeks at suse.com>
Date: Wed Oct 26 12:39:08 2011 +0100
generic: cleanup vcl / X11 display abstraction to fix crasher
Thanks to sberg for the pointer.
diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx
index ac97bad..e65b8bd 100644
--- a/vcl/inc/unx/saldisp.hxx
+++ b/vcl/inc/unx/saldisp.hxx
@@ -440,7 +440,7 @@ public:
std::list< SalObject* >& getSalObjects() { return m_aSalObjects; }
- virtual void PostUserEvent();
+ virtual void PostUserEvent() = 0;
};
// -=-= inlines =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
@@ -463,6 +463,8 @@ public:
virtual long Dispatch( XEvent *pEvent );
virtual void Yield();
+ virtual void PostUserEvent();
+
sal_Bool IsEvent();
void SetupInput( SalI18N_InputMethod *pInputMethod );
};
diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx
index 8eb6602..93d5ea6 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 515f433..74c4ef7 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: */
More information about the Libreoffice-commits
mailing list