From 6ad62591bed5ad97dfcd2e222a540219db9b7542 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 12 Sep 2013 20:49:18 +0000 Subject: [PATCH] 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 --- src/common/ffile.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/common/ffile.cpp b/src/common/ffile.cpp index 79afbaef33..0f479565d2 100644 --- a/src/common/ffile.cpp +++ b/src/common/ffile.cpp @@ -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; -- 2.45.2