diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-08-24 13:53:27 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-08-24 13:53:55 +0100 |
commit | cbe995205c20663f4f90ca8e1cea081a313d94e9 (patch) | |
tree | fa86438a03b31cd02db7d4944585d3947a8c32a8 /vcl | |
parent | potential WaE (diff) | |
download | core-cbe995205c20663f4f90ca8e1cea081a313d94e9.tar.gz core-cbe995205c20663f4f90ca8e1cea081a313d94e9.zip |
avoid crash on shutdown with unprocessed events pending post SalDisplay dtor
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/gtk/app/gtkdata.cxx | 35 |
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(); |