]> git.saurik.com Git - wxWidgets.git/commitdiff
fixing naming to conform to effective ownership, cleaning up releasing
authorStefan Csomor <csomor@advancedconcepts.ch>
Wed, 16 Feb 2011 06:55:43 +0000 (06:55 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Wed, 16 Feb 2011 06:55:43 +0000 (06:55 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66899 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/cocoa/filedlg.mm

index 3e5de2867b0597aa3fd9084a293e1a3f19f6bb30..8002af191a1967ccfa91f273ec3752549f31bcb1 100644 (file)
@@ -57,7 +57,7 @@ bool wxFileDialog::SupportsExtraControl() const
     return true;
 }
 
-NSArray* GetTypesFromFilter( const wxString filter )
+NSArray* CopyTypesFromFilter( const wxString filter )
 {
     NSMutableArray* types = nil;
     if ( !filter.empty() )
@@ -127,8 +127,8 @@ NSArray* GetTypesFromFilter( const wxString filter )
 
                 if ( extension.IsEmpty() )
                 {
-                    if ( types != nil )
-                        [types release];
+                    [types release];
+                    types = nil;
                     return nil;
                 }
 
@@ -188,7 +188,7 @@ void wxFileDialog::ShowWindowModal()
     }
     else 
     {
-        NSArray* types = GetTypesFromFilter( m_wildCard ) ;
+        NSArray* types = CopyTypesFromFilter( m_wildCard ) ;
         NSOpenPanel* oPanel = [NSOpenPanel openPanel];
         
         SetupExtraControls(oPanel);
@@ -207,6 +207,8 @@ void wxFileDialog::ShowWindowModal()
             modalDelegate: sheetDelegate
             didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:)
             contextInfo: nil];
+        [types release];
+        types = nil;
     }
 }
 
@@ -280,7 +282,7 @@ int wxFileDialog::ShowModal()
     }
     else
     {
-        NSArray* types = GetTypesFromFilter( m_wildCard ) ;
+        NSArray* types = CopyTypesFromFilter( m_wildCard ) ;
         NSOpenPanel* oPanel = [NSOpenPanel openPanel];
         
         SetupExtraControls(oPanel);
@@ -299,8 +301,8 @@ int wxFileDialog::ShowModal()
         UnsubclassWin();
         [oPanel setAccessoryView:nil];
         
-        if ( types != nil )
-            [types release];
+        [types release];
+        types = nil;
     }
 
     return GetReturnCode();