Index: src/libchcore/TConfig.cpp =================================================================== diff -u -N -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 -r1e550337d5944f7d73ca425fc5e266ee0dbaa6f2 --- src/libchcore/TConfig.cpp (.../TConfig.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) +++ src/libchcore/TConfig.cpp (.../TConfig.cpp) (revision 1e550337d5944f7d73ca425fc5e266ee0dbaa6f2) @@ -77,19 +77,21 @@ if(!pszFile) THROW(_T("Invalid argument"), 0, 0, 0); + { + boost::unique_lock lock(GetImpl()->m_lock); + // Note: we need to store filename for later use BEFORE trying to open a file + // since it might be nonexistent, but we still would like to store config to this file later + ClearNL(); + GetImpl()->m_strFilePath = pszFile; + } + // convert our underlying data to a property tree (currently probably the easiest way to convert data to xml boost::property_tree::wiptree tPropertyTree; std::wifstream ifs(pszFile, std::ios_base::in); boost::property_tree::xml_parser::read_xml(ifs, tPropertyTree); boost::unique_lock lock(GetImpl()->m_lock); - - // Note: we need to store filename for later use BEFORE trying to open a file - // since it might be nonexistent, but we still would like to store config to this file later - ClearNL(); - GetImpl()->m_strFilePath = pszFile; - GetImpl()->ImportFromPropertyTree(tPropertyTree, lock); }