fix memory leak in wxGetTempFileName(const wxString&, wxString&) overload; also define wxGetTempFileName(const wxString&, wxChar *) overload in terms of the other one and not vice versa
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42110 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1280,9 +1280,8 @@ bool wxDirExists(const wxChar *pszPathName)
|
||||
// Get a temporary filename, opening and closing the file.
|
||||
wxChar *wxGetTempFileName(const wxString& prefix, wxChar *buf)
|
||||
{
|
||||
#if wxUSE_FILE
|
||||
wxString filename = wxFileName::CreateTempFileName(prefix);
|
||||
if ( filename.empty() )
|
||||
wxString filename;
|
||||
if ( !wxGetTempFileName(prefix, filename) )
|
||||
return NULL;
|
||||
|
||||
if ( buf )
|
||||
@@ -1291,19 +1290,20 @@ wxChar *wxGetTempFileName(const wxString& prefix, wxChar *buf)
|
||||
buf = MYcopystring(filename);
|
||||
|
||||
return buf;
|
||||
#else
|
||||
wxUnusedVar(prefix);
|
||||
wxUnusedVar(buf);
|
||||
// wxFileName::CreateTempFileName needs wxFile class enabled
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool wxGetTempFileName(const wxString& prefix, wxString& buf)
|
||||
{
|
||||
#if wxUSE_FILE
|
||||
buf = wxGetTempFileName(prefix);
|
||||
|
||||
return !buf.empty();
|
||||
#else // !wxUSE_FILE
|
||||
wxUnusedVar(prefix);
|
||||
wxUnusedVar(buf);
|
||||
|
||||
return false;
|
||||
#endif // wxUSE_FILE/!wxUSE_FILE
|
||||
}
|
||||
|
||||
// Get first file name matching given wild card.
|
||||
|
Reference in New Issue
Block a user