use (new) safer GetTraitsIfExists() in wxMutexGuiEnter/Leave() to avoid crashing on exit of wxGTK1 applications putting anything on clipboard (and maybe other cases)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54735 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -290,6 +290,13 @@ wxAppTraits *wxAppConsoleBase::GetTraits()
|
||||
return m_traits;
|
||||
}
|
||||
|
||||
/* static */
|
||||
wxAppTraits *wxAppConsoleBase::GetTraitsIfExists()
|
||||
{
|
||||
wxAppConsole * const app = GetInstance();
|
||||
return app ? app->GetTraits() : NULL;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event processing
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -673,12 +680,16 @@ void wxAppTraitsBase::MutexGuiLeave()
|
||||
|
||||
void WXDLLIMPEXP_BASE wxMutexGuiEnter()
|
||||
{
|
||||
wxAppConsoleBase::GetInstance()->GetTraits()->MutexGuiEnter();
|
||||
wxAppTraits * const traits = wxAppConsoleBase::GetTraitsIfExists();
|
||||
if ( traits )
|
||||
traits->MutexGuiEnter();
|
||||
}
|
||||
|
||||
void WXDLLIMPEXP_BASE wxMutexGuiLeave()
|
||||
{
|
||||
wxAppConsoleBase::GetInstance()->GetTraits()->MutexGuiLeave();
|
||||
wxAppTraits * const traits = wxAppConsoleBase::GetTraitsIfExists();
|
||||
if ( traits )
|
||||
traits->MutexGuiLeave();
|
||||
}
|
||||
#endif // wxUSE_THREADS
|
||||
|
||||
|
Reference in New Issue
Block a user