macOS bugfix: overrelease in wxGetAvailableDrives
as these strings are NSStrings retrieved by autoreleasing methods, they must be retained first
This commit is contained in:
@@ -76,4 +76,28 @@ public:
|
|||||||
private:
|
private:
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
/*! @function wxCFStringRefFromGet
|
||||||
|
@abstract Factory function to create wxCFStringRefRef from a CFStringRef obtained from a Get-rule function
|
||||||
|
@param p The CFStringRef to retain and create a wxCFStringRefRef from. May be NULL.
|
||||||
|
@discussion Unlike the wxCFStringRef raw pointer constructor, this function explicitly retains its
|
||||||
|
argument. This can be used for functions ) which return a temporary reference (Get-rule functions).
|
||||||
|
*/
|
||||||
|
inline wxCFStringRef wxCFStringRefFromGet(CFStringRef p)
|
||||||
|
{
|
||||||
|
return wxCFStringRef(wxCFRetain(p));
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
/*! @function wxCFStringRefFromGet
|
||||||
|
@abstract Factory function to create wxCFStringRefRef from a NSString* obtained from a Get-rule function
|
||||||
|
@param p The NSString pointer to retain and create a wxCFStringRefRef from. May be NULL.
|
||||||
|
@discussion Unlike the wxCFStringRef raw pointer constructor, this function explicitly retains its
|
||||||
|
argument. This can be used for functions ) which return a temporary reference (Get-rule functions).
|
||||||
|
*/
|
||||||
|
inline wxCFStringRef wxCFStringRefFromGet(NSString *p)
|
||||||
|
{
|
||||||
|
return wxCFStringRefFromGet((CFStringRef)p);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif //__WXCFSTRINGHOLDER_H__
|
#endif //__WXCFSTRINGHOLDER_H__
|
||||||
|
@@ -194,8 +194,8 @@ size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayI
|
|||||||
|
|
||||||
name = [filemanager displayNameAtPath:path];
|
name = [filemanager displayNameAtPath:path];
|
||||||
|
|
||||||
paths.Add(wxCFStringRef(path).AsString());
|
paths.Add(wxCFStringRefFromGet(path).AsString());
|
||||||
names.Add(wxCFStringRef(name).AsString());
|
names.Add(wxCFStringRefFromGet(name).AsString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user