]> git.saurik.com Git - wxWidgets.git/blobdiff - src/unix/mimetype.cpp
reverted part of patch 1610494 (rev 1.35) which broke handling of ends of lines
[wxWidgets.git] / src / unix / mimetype.cpp
index 76723ea65b42dc9085cb1e65f9c929b279505460..a1b56f14d6eda084cc5600678e6ac86ab7deb423 100644 (file)
@@ -1425,14 +1425,27 @@ wxFileTypeImpl::SetCommand(const wxString& cmd,
     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++ )
     {
-        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;
 }