From 2c032a5d7197121c10d983892a499a7facb22dfb Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 10 Nov 2010 13:53:15 +0000 Subject: [PATCH] Don't crash in wxGUIEventLoop::Exit() if not running in wxX11. The implementation of wxEventLoop::IsRunning() has changed since this code was written and it doesn't check for m_impl != NULL any more. Because of this, calling Exit() for an active but not running event loop resulted in a crash in wxX11. Fix this by doing nothing in this case. This seems better than asserting as the event handling code exits the loop if an event handler throws an exception and the loop might not be running in this case yet (events could be processed because of a wxYield() call). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66098 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/x11/evtloop.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/x11/evtloop.cpp b/src/x11/evtloop.cpp index 2c78103d9a..146fabde14 100644 --- a/src/x11/evtloop.cpp +++ b/src/x11/evtloop.cpp @@ -128,7 +128,7 @@ wxGUIEventLoop::~wxGUIEventLoop() int wxGUIEventLoop::Run() { // event loops are not recursive, you need to create another loop! - wxCHECK_MSG( !IsRunning(), -1, wxT("can't reenter a message loop") ); + wxCHECK_MSG( !m_impl, -1, wxT("can't reenter a message loop") ); m_impl = new wxEventLoopImpl; @@ -169,10 +169,11 @@ int wxGUIEventLoop::Run() void wxGUIEventLoop::Exit(int rc) { - wxCHECK_RET( IsRunning(), wxT("can't call Exit() if not running") ); - - m_impl->SetExitCode(rc); - m_impl->m_keepGoing = false; + if ( m_impl ) + { + m_impl->SetExitCode(rc); + m_impl->m_keepGoing = false; + } } // ---------------------------------------------------------------------------- -- 2.45.2