Don't reset m_fp if wxFFile::Open() fails.
This makes it behaviour consistent with wxFile::Open(). Also don't use Detach() in Close(), again for consistency with wxFile, even if this has no user-visible effects at all. See #15494. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74799 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
37961915e7
commit
6ad62591be
@ -47,7 +47,7 @@
|
||||
|
||||
wxFFile::wxFFile(const wxString& filename, const wxString& mode)
|
||||
{
|
||||
Detach();
|
||||
m_fp = NULL;
|
||||
|
||||
(void)Open(filename, mode);
|
||||
}
|
||||
@ -56,16 +56,16 @@ bool wxFFile::Open(const wxString& filename, const wxString& mode)
|
||||
{
|
||||
wxASSERT_MSG( !m_fp, wxT("should close or detach the old file first") );
|
||||
|
||||
m_fp = wxFopen(filename, mode);
|
||||
FILE* const fp = wxFopen(filename, mode);
|
||||
|
||||
if ( !m_fp )
|
||||
if ( !fp )
|
||||
{
|
||||
wxLogSysError(_("can't open file '%s'"), filename);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
m_name = filename;
|
||||
Attach(fp, filename);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -81,7 +81,7 @@ bool wxFFile::Close()
|
||||
return false;
|
||||
}
|
||||
|
||||
Detach();
|
||||
m_fp = NULL;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user