*** a/pgadmin/frm/frmMain.cpp --- b/pgadmin/frm/frmMain.cpp *************** *** 1214,1219 **** --- 1214,1220 ---- // Write the server count settings->WriteInt(wxT("Servers/Count"), numServers); + settings->Flush(); wxLogInfo(wxT("Stored %d servers."), numServers); } *** a/pgadmin/include/utils/sysSettings.h --- b/pgadmin/include/utils/sysSettings.h *************** *** 716,730 **** public: // Functions for storing settings bool Write(const wxString &key, const wxString &value) { ! return wxConfig::Write(key, value); } bool WriteLong(const wxString &key, long value) { ! return wxConfig::Write(key, value); } bool WriteInt(const wxString &key, int value) { ! return wxConfig::Write(key, value); } bool WriteBool(const wxString &key, bool value); bool WritePoint(const wxString &key, const wxPoint &value); --- 716,736 ---- // Functions for storing settings bool Write(const wxString &key, const wxString &value) { ! bool b = wxConfig::Write(key, value); ! checkWriteCounter(); ! return b; } bool WriteLong(const wxString &key, long value) { ! bool b = wxConfig::Write(key, value); ! checkWriteCounter(); ! return b; } bool WriteInt(const wxString &key, int value) { ! bool b = wxConfig::Write(key, value); ! checkWriteCounter(); ! return b; } bool WriteBool(const wxString &key, bool value); bool WritePoint(const wxString &key, const wxPoint &value); *************** *** 752,757 **** public: --- 758,772 ---- }; static wxString GetConfigFile(configFileName cfgname); + bool Flush(bool bCurrentOnly = false) + { + if (writeCounter) + { + wxConfig::Flush(bCurrentOnly); + writeCounter = 0; + } + } + private: static const wxString &getDefaultElementColor(int index) { *************** *** 768,773 **** private: --- 783,798 ---- bool moveLongValue(const wxChar *oldKey, const wxChar *newKey, int index = -1); wxFileConfig *defaultSettings; + int writeCounter; + + void checkWriteCounter() + { + writeCounter++; + if (writeCounter > 2) + { + Flush(); + } + } }; #endif