X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7ac1b576c496b3cd48d6a494b51261b8eb6fb635..60d66be369d360e1528e4dd4bb65a909a8c6ac9a:/src/common/persist.cpp diff --git a/src/common/persist.cpp b/src/common/persist.cpp index 64b5957c7c..4ca337cc0c 100644 --- a/src/common/persist.cpp +++ b/src/common/persist.cpp @@ -30,16 +30,34 @@ #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; + + gs_manager = &s_manager; + } - return s_manager; + return *gs_manager; } wxPersistenceManager::~wxPersistenceManager() @@ -152,6 +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