X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6ee654e6bb28d20841d115f667239739e3ac42ef..eca370a9cf88259480e9f34afc17347ce603ff37:/src/common/filesys.cpp diff --git a/src/common/filesys.cpp b/src/common/filesys.cpp index 159c29c6db..d5a3bf6454 100644 --- a/src/common/filesys.cpp +++ b/src/common/filesys.cpp @@ -26,6 +26,10 @@ #include "wx/wfstream.h" #include "wx/module.h" #include "wx/filesys.h" +#include "wx/mimetype.h" + + + //-------------------------------------------------------------------------------- // wxFileSystemHandler @@ -33,14 +37,6 @@ IMPLEMENT_ABSTRACT_CLASS(wxFileSystemHandler, wxObject) -wxMimeTypesManager *wxFileSystemHandler::m_MimeMng = NULL; - -void wxFileSystemHandler::CleanUpStatics() -{ - if (m_MimeMng) delete m_MimeMng; - m_MimeMng = NULL; -} - wxString wxFileSystemHandler::GetMimeTypeFromExt(const wxString& location) { @@ -58,9 +54,8 @@ wxString wxFileSystemHandler::GetMimeTypeFromExt(const wxString& location) if ((c == wxT('/')) || (c == wxT('\\')) || (c == wxT(':'))) {return wxEmptyString;} } - if (m_MimeMng == NULL) { - m_MimeMng = new wxMimeTypesManager; - + static bool s_MinimalMimeEnsured = FALSE; + if (!s_MinimalMimeEnsured) { static const wxFileTypeInfo fallbacks[] = { wxFileTypeInfo("image/jpeg", @@ -93,10 +88,10 @@ wxString wxFileSystemHandler::GetMimeTypeFromExt(const wxString& location) wxFileTypeInfo() }; - m_MimeMng -> AddFallbacks(fallbacks); + wxTheMimeTypesManager -> AddFallbacks(fallbacks); } - ft = m_MimeMng -> GetFileTypeFromExtension(ext); + ft = wxTheMimeTypesManager -> GetFileTypeFromExtension(ext); if (ft && (ft -> GetMimeType(&mime))) { delete ft; return mime; @@ -412,7 +407,6 @@ class wxFileSystemModule : public wxModule } virtual void OnExit() { - wxFileSystemHandler::CleanUpStatics(); wxFileSystem::CleanUpHandlers(); } };