Permalink
Browse files

Lower the chance to clear config file

Open the file as late as possible to lower the chance that the scim program
exits before writing completely
  • Loading branch information...
1 parent d3f198a commit eb03a179969fc4a8f48973cfe75ee5982d5d15a5 @tzhuan tzhuan committed May 29, 2016
Showing with 2 additions and 3 deletions.
  1. +2 −3 modules/Config/scim_simple_config.cpp
@@ -382,9 +382,6 @@ SimpleConfig::flush()
// Reload config to ensure user made modification won't lost.
load_all_config ();
- std::ofstream os (userconf.c_str ());
- if (!os) return false;
-
KeyValueRepository::iterator i;
std::vector<String>::iterator j;
@@ -408,6 +405,8 @@ SimpleConfig::flush()
m_config [String (SCIM_CONFIG_UPDATE_TIMESTAMP)] = String (buf);
+ std::ofstream os (userconf.c_str ());
+ if (!os) return false;
save_config (os);
return true;
}

0 comments on commit eb03a17

Please sign in to comment.