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
wxFFile::wxFFile(const wxString& filename, const wxString& mode)
{
- Detach();
+ m_fp = NULL;
(void)Open(filename, 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;
}
return false;
}
- Detach();
+ m_fp = NULL;
}
return true;