summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-08-24 13:53:27 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-08-24 13:53:55 +0100
commitcbe995205c20663f4f90ca8e1cea081a313d94e9 (patch)
treefa86438a03b31cd02db7d4944585d3947a8c32a8 /vcl
parent2c87725f1268f0dd2ae5c3e35475b04f3296ab01 (diff)
avoid crash on shutdown with unprocessed events pending post SalDisplay dtor
Diffstat (limited to 'vcl')
-rw-r--r--vcl/unx/gtk/app/gtkdata.cxx35
1 files changed, 22 insertions, 13 deletions
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index dde909ff27f2..b68d02335ff1 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -859,28 +859,37 @@ extern "C"
gboolean GtkXLib::userEventFn(gpointer data)
{
- gboolean bContinue;
+ gboolean bContinue = FALSE;
GtkXLib *pThis = (GtkXLib *) data;
- SalData *pSalData = GetSalData();
+ X11SalData *pSalData = GetX11SalData();
pSalData->m_pInstance->GetYieldMutex()->acquire();
- pThis->m_pGtkSalDisplay->EventGuardAcquire();
- if( !pThis->m_pGtkSalDisplay->HasMoreEvents() )
+ const SalDisplay *pDisplay = pSalData->GetDisplay();
+ //GtkSalDisplay inherits from SalDisplay, SalDisplay's dtor deregisters
+ //itself from SalData, so use presence of pDisplay here to detect that
+ //m_pGtkSalDisplay was destroyed by X11SalData::DeleteDisplay
+ if (pDisplay)
{
- if( pThis->m_pUserEvent )
+ OSL_ASSERT(pThis->m_pGtkSalDisplay == pDisplay);
+ pThis->m_pGtkSalDisplay->EventGuardAcquire();
+
+ if( !pThis->m_pGtkSalDisplay->HasMoreEvents() )
{
- g_source_unref (pThis->m_pUserEvent);
- pThis->m_pUserEvent = NULL;
+ if( pThis->m_pUserEvent )
+ {
+ g_source_unref (pThis->m_pUserEvent);
+ pThis->m_pUserEvent = NULL;
+ }
+ bContinue = FALSE;
}
- bContinue = FALSE;
- }
- else
- bContinue = TRUE;
+ else
+ bContinue = TRUE;
- pThis->m_pGtkSalDisplay->EventGuardRelease();
+ pThis->m_pGtkSalDisplay->EventGuardRelease();
- pThis->m_pGtkSalDisplay->DispatchInternalEvent();
+ pThis->m_pGtkSalDisplay->DispatchInternalEvent();
+ }
pSalData->m_pInstance->GetYieldMutex()->release();