]> git.saurik.com Git - wxWidgets.git/blobdiff - src/unix/mimetype.cpp
Use our own getters and properties for wxVisualAttributes
[wxWidgets.git] / src / unix / mimetype.cpp
index 0d9de5f65f1fd9a613c427a903ce119bc4e18464..a1b56f14d6eda084cc5600678e6ac86ab7deb423 100644 (file)
@@ -1425,14 +1425,27 @@ wxFileTypeImpl::SetCommand(const wxString& cmd,
     wxMimeTypeCommands *entry = new wxMimeTypeCommands();
     entry->Add(verb + wxT("=")  + cmd + wxT(" %s "));
 
     wxMimeTypeCommands *entry = new wxMimeTypeCommands();
     entry->Add(verb + wxT("=")  + cmd + wxT(" %s "));
 
-    bool ok = true;
+    bool ok = false;
     size_t nCount = strTypes.GetCount();
     for ( size_t i = 0; i < nCount; i++ )
     {
     size_t nCount = strTypes.GetCount();
     for ( size_t i = 0; i < nCount; i++ )
     {
-        if (!m_manager->DoAssociation(strTypes[i], strIcon, entry, strExtensions, strDesc))
-            ok = false;
+        if ( m_manager->DoAssociation
+                        (
+                            strTypes[i],
+                            strIcon,
+                            entry,
+                            strExtensions,
+                            strDesc
+                        ) )
+        {
+            // DoAssociation() took ownership of entry, don't delete it below
+            ok = true;
+        }
     }
 
     }
 
+    if ( !ok )
+        delete entry;
+
     return ok;
 }
 
     return ok;
 }
 
@@ -1451,23 +1464,28 @@ bool wxFileTypeImpl::SetDefaultIcon(const wxString& strIcon, int WXUNUSED(index)
         return false;
 
     wxMimeTypeCommands *entry = new wxMimeTypeCommands();
         return false;
 
     wxMimeTypeCommands *entry = new wxMimeTypeCommands();
-    bool ok = true;
+    bool ok = false;
     size_t nCount = strTypes.GetCount();
     for ( size_t i = 0; i < nCount; i++ )
     {
     size_t nCount = strTypes.GetCount();
     for ( size_t i = 0; i < nCount; i++ )
     {
-        if ( !m_manager->DoAssociation
-                         (
+        if ( m_manager->DoAssociation
+                        (
                             strTypes[i],
                             strIcon,
                             entry,
                             strExtensions,
                             strDesc
                             strTypes[i],
                             strIcon,
                             entry,
                             strExtensions,
                             strDesc
-                         ) )
+                        ) )
         {
         {
-            ok = false;
+            // we don't need to free entry now, DoAssociation() took ownership
+            // of it
+            ok = true;
         }
     }
 
         }
     }
 
+    if ( !ok )
+        delete entry;
+
     return ok;
 }
 
     return ok;
 }
 
@@ -2747,8 +2765,8 @@ bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName,
 
         if ( data.needsterminal )
         {
 
         if ( data.needsterminal )
         {
-            data.cmdOpen.Printf(wxT("xterm -e sh -c '%s'"),
-                                            data.cmdOpen.c_str());
+            data.cmdOpen.insert(0, wxT("xterm -e sh -c '"));
+            data.cmdOpen.append(wxT("'"));
         }
 
         if ( !data.cmdOpen.empty() )
         }
 
         if ( !data.cmdOpen.empty() )