Ensure that there is a modal event loop before trying to use it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69704 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2011-11-08 17:40:28 +00:00
parent 56c1c29904
commit 85fb0a0afd

View File

@@ -421,7 +421,8 @@ void wxWindowDisabler::DoDisable(wxWindow *winToSkip)
} }
m_modalEventLoop = (wxEventLoop*)wxEventLoopBase::GetActive(); m_modalEventLoop = (wxEventLoop*)wxEventLoopBase::GetActive();
m_modalEventLoop->BeginModalSession(winToSkip); if (m_modalEventLoop)
m_modalEventLoop->BeginModalSession(winToSkip);
} }
wxWindowDisabler::~wxWindowDisabler() wxWindowDisabler::~wxWindowDisabler()
@@ -429,7 +430,8 @@ wxWindowDisabler::~wxWindowDisabler()
if ( !m_disabled ) if ( !m_disabled )
return; return;
m_modalEventLoop->EndModalSession(); if (m_modalEventLoop)
m_modalEventLoop->EndModalSession();
wxWindowList::compatibility_iterator node; wxWindowList::compatibility_iterator node;
for ( node = wxTopLevelWindows.GetFirst(); node; node = node->GetNext() ) for ( node = wxTopLevelWindows.GetFirst(); node; node = node->GetNext() )