X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=sidebyside;f=synfig-core%2Fsrc%2Fsynfig%2Fgeneral.h;h=04429189aa9b6c436eaca9776d05b45aebb5a1b2;hb=406dc17260884fc08a0f5c126e4bdbc7505a5035;hp=639eb514098448521f6e372bb1e2e0500573cace;hpb=477fd4ea9c6133e098572554a9eadbf503e27fab;p=synfig.git diff --git a/synfig-core/src/synfig/general.h b/synfig-core/src/synfig/general.h index 639eb51..0442918 100644 --- a/synfig-core/src/synfig/general.h +++ b/synfig-core/src/synfig/general.h @@ -69,16 +69,20 @@ namespace synfig { class ChangeLocale { - const String previous; - const int category; + const String previous; + const int category; public: - ChangeLocale(int category, const char *locale): - previous(setlocale(category,locale)),category(category) - { - } - ~ChangeLocale() { - setlocale(category,previous.c_str()); - } + ChangeLocale(int category, const char *locale): + // This backups the old locale + previous(setlocale(category,NULL)),category(category) + { + // This effectively changes the locale + setlocale(category, locale); + } + ~ChangeLocale() { + // This restores the locale + setlocale(category,previous.c_str()); + } }; /*! \class ProgressCallback