Fix crash in wxMimeTypesManager [backport of r63935 from trunk].
Don't crash if wxMimeTypesManager is used before wxApp creation. See #11927. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@63936 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1525,15 +1525,20 @@ void wxMimeTypesManagerImpl::InitIfNeeded()
|
||||
{
|
||||
// set the flag first to prevent recursion
|
||||
m_initialized = true;
|
||||
|
||||
wxString wm = wxTheApp->GetTraits()->GetDesktopEnvironment();
|
||||
|
||||
if (wm == wxT("KDE"))
|
||||
Initialize( wxMAILCAP_KDE );
|
||||
else if (wm == wxT("GNOME"))
|
||||
Initialize( wxMAILCAP_GNOME );
|
||||
else
|
||||
Initialize();
|
||||
|
||||
int mailcapStyles = wxMAILCAP_ALL;
|
||||
if ( wxAppTraits * const traits = wxApp::GetTraitsIfExists() )
|
||||
{
|
||||
wxString wm = traits->GetDesktopEnvironment();
|
||||
|
||||
if ( wm == "KDE" )
|
||||
mailcapStyles = wxMAILCAP_KDE;
|
||||
else if ( wm == "GNOME" )
|
||||
mailcapStyles = wxMAILCAP_GNOME;
|
||||
//else: unknown, use the default
|
||||
}
|
||||
|
||||
Initialize(mailcapStyles);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user