]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/mimecmn.cpp
fix recently introduced memory leak of m_conv (bug 1466559)
[wxWidgets.git] / src / common / mimecmn.cpp
index cdf3108be843f3fb0b55a230c83f512aa2b2b979..104285eac58797eeac8c28177d0b971b94882e07 100644 (file)
@@ -81,7 +81,17 @@ wxFileTypeInfo::wxFileTypeInfo(const wxChar *mimeType,
 
     for ( ;; )
     {
+        // icc gives this warning in its own va_arg() macro, argh
+#ifdef __INTELC__
+    #pragma warning(push)
+    #pragma warning(disable: 1684)
+#endif
+
         const wxChar *ext = va_arg(argptr, const wxChar *);
+
+#ifdef __INTELC__
+    #pragma warning(pop)
+#endif
         if ( !ext )
         {
             // NULL terminates the list
@@ -443,6 +453,34 @@ bool wxFileType::SetDefaultIcon(const wxString& cmd, int index)
 #endif
 }
 
+//----------------------------------------------------------------------------
+// wxMimeTypesManagerFactory
+//----------------------------------------------------------------------------
+
+wxMimeTypesManagerFactory *wxMimeTypesManagerFactory::m_factory = NULL;
+
+/* static */ 
+void wxMimeTypesManagerFactory::SetFactory( wxMimeTypesManagerFactory *factory )
+{
+    if (wxMimeTypesManagerFactory::m_factory)
+        delete wxMimeTypesManagerFactory::m_factory;
+
+    wxMimeTypesManagerFactory::m_factory = factory;
+}
+
+/* static */ 
+wxMimeTypesManagerFactory *wxMimeTypesManagerFactory::GetFactory()
+{
+    if (!wxMimeTypesManagerFactory::m_factory)
+        wxMimeTypesManagerFactory::m_factory = new wxMimeTypesManagerFactory;
+
+    return wxMimeTypesManagerFactory::m_factory;
+}
+
+wxMimeTypesManagerImpl *wxMimeTypesManagerFactory::CreateMimeTypesManagerImpl()
+{
+    return new wxMimeTypesManagerImpl;
+}
 
 // ----------------------------------------------------------------------------
 // wxMimeTypesManager
@@ -451,7 +489,7 @@ bool wxFileType::SetDefaultIcon(const wxString& cmd, int index)
 void wxMimeTypesManager::EnsureImpl()
 {
     if ( !m_impl )
-        m_impl = new wxMimeTypesManagerImpl;
+        m_impl = wxMimeTypesManagerFactory::GetFactory()->CreateMimeTypesManagerImpl();
 }
 
 bool wxMimeTypesManager::IsOfType(const wxString& mimeType,