summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Power <noel.power@novell.com>2011-11-14 11:17:07 +0000
committerNoel Power <noel.power@novell.com>2011-11-14 11:27:29 +0000
commit1b20ed98b65a9101162058a54c2d62eea8664b11 (patch)
tree7f7142d4d5e8756496d9462376ba319ee6d663d4
parent082ecb53a9077b6ae01ce66237f48d88bcb0cc00 (diff)
fix crash at exit ( access of deleted GtkSalDisplay instance ) bnc#728603
Signed-off-by: Michael Meeks <michael.meeks@suse.com>
-rw-r--r--vcl/unx/gtk/app/gtkdata.cxx44
1 files changed, 29 insertions, 15 deletions
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index 6a61098b98..a1c8b2fce1 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -576,6 +576,14 @@ GtkXLib::~GtkXLib()
#endif
Yield( true, true );
StopTimer();
+
+ if (m_pUserEvent)
+ {
+ g_source_destroy (m_pUserEvent);
+ g_source_unref (m_pUserEvent);
+ m_pUserEvent = NULL;
+ }
+
// sanity check: at this point nobody should be yielding, but wake them
// up anyway before the condition they're waiting on gets destroyed.
osl_setCondition( m_aDispatchCondition );
@@ -792,30 +800,36 @@ extern "C"
gboolean GtkXLib::userEventFn(gpointer data)
{
- gboolean bContinue;
+
+ gboolean bContinue = FALSE;
GtkXLib *pThis = (GtkXLib *) data;
- SalData *pSalData = GetSalData();
- pSalData->m_pInstance->GetYieldMutex()->acquire();
- pThis->m_pGtkSalDisplay->EventGuardAcquire();
+ GtkData *pGtkData = static_cast<GtkData*>(GetSalData());
+
+ pGtkData->m_pInstance->GetYieldMutex()->acquire();
- if( !pThis->m_pGtkSalDisplay->HasMoreEvents() )
+ if ( pGtkData->GetDisplay() )
{
- if( pThis->m_pUserEvent )
+ 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();
+ pGtkData->m_pInstance->GetYieldMutex()->release();
+ }
return bContinue;
}