X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5bca8be2cf427f9f7f79212ca086bf715085f7f9..38aae140acbfd562df1388ae76108efcc52f871c:/src/common/persist.cpp diff --git a/src/common/persist.cpp b/src/common/persist.cpp index 76ab2698bd..4ca337cc0c 100644 --- a/src/common/persist.cpp +++ b/src/common/persist.cpp @@ -23,21 +23,41 @@ #pragma hdrstop #endif +#if wxUSE_CONFIG + #ifndef WX_PRECOMP #endif // WX_PRECOMP #include "wx/persist.h" +namespace +{ + +wxPersistenceManager* gs_manager = NULL; + +} // anonymous namespace + // ============================================================================ // wxPersistenceManager implementation // ============================================================================ +/* static */ +void wxPersistenceManager::Set(wxPersistenceManager& manager) +{ + gs_manager = &manager; +} + /* static */ wxPersistenceManager& wxPersistenceManager::Get() { - static wxPersistenceManager s_manager; + if ( !gs_manager ) + { + static wxPersistenceManager s_manager; - return s_manager; + gs_manager = &s_manager; + } + + return *gs_manager; } wxPersistenceManager::~wxPersistenceManager() @@ -150,4 +170,6 @@ wxPERSIST_DEFINE_SAVE_RESTORE_FOR(int) wxPERSIST_DEFINE_SAVE_RESTORE_FOR(long) wxPERSIST_DEFINE_SAVE_RESTORE_FOR(wxString) -#undef wxPERSIST_DEFINE_SAVE_RESTORE_FOR +#undef wxPERSIST_DEFINE_SAVE_RESTORE_FOR + +#endif // wxUSE_CONFIG