macOS bugfix: overrelease in wxGetAvailableDrives

as these strings are NSStrings retrieved by autoreleasing methods, they must be retained first
This commit is contained in:
Stefan Csomor
2020-07-26 11:37:55 +02:00
parent a1774fcc4e
commit bb40699675
2 changed files with 26 additions and 2 deletions

View File

@@ -76,4 +76,28 @@ public:
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__