Allow disabling saving wxFileConfig data when it is destroyed

This can be useful to avoid saving the changes performed by the user if
this turns out to be undesirable, for whatever reason.

Closes https://github.com/wxWidgets/wxWidgets/pull/1451

Closes #13788.
This commit is contained in:
Igor Korot
2019-07-30 00:01:32 -05:00
committed by Vadim Zeitlin
parent e31938c314
commit c525784f77
3 changed files with 30 additions and 1 deletions

View File

@@ -346,6 +346,7 @@ void wxFileConfig::Init()
}
m_isDirty = false;
m_autosave = true;
}
// constructor supports creation of wxFileConfig objects of any type
@@ -487,7 +488,8 @@ void wxFileConfig::CleanUp()
wxFileConfig::~wxFileConfig()
{
Flush();
if ( m_autosave )
Flush();
CleanUp();