Prevent unsafe thread change of local settings using synfig::ChangeLocale class
[synfig.git] / synfig-studio / src / gui / states / state_smoothmove.cpp
index f42df35..36bfecd 100644 (file)
@@ -49,7 +49,7 @@
 #include "event_mouse.h"
 #include "event_layerclick.h"
 #include "toolbox.h"
-#include "dialog_tooloptions.h"
+#include "docks/dialog_tooloptions.h"
 #include <gtkmm/optionmenu.h>
 #include "duck.h"
 #include "onemoment.h"
@@ -155,18 +155,34 @@ StateSmoothMove::~StateSmoothMove()
 void
 StateSmoothMove_Context::load_settings()
 {
-       String value;
+       try
+       {
+               synfig::ChangeLocale change_locale(LC_NUMERIC, "C");
+               String value;
 
-       if(settings.get_value("smooth_move.radius",value))
-               set_radius(atof(value.c_str()));
-       else
-               set_radius(1.0f);
+               if(settings.get_value("smooth_move.radius",value))
+                       set_radius(atof(value.c_str()));
+               else
+                       set_radius(1.0f);
+       }
+       catch(...)
+       {
+               synfig::warning("State SmothMove: Caught exception when attempting to load settings.");
+       }
 }
 
 void
 StateSmoothMove_Context::save_settings()
 {
-       settings.set_value("smooth_move.radius",strprintf("%f",get_radius()));
+       try
+       {
+       synfig::ChangeLocale change_locale(LC_NUMERIC, "C");
+               settings.set_value("smooth_move.radius",strprintf("%f",get_radius()));
+       }
+       catch(...)
+       {
+               synfig::warning("State SmoothMove: Caught exception when attempting to save settings.");
+       }
 }
 
 StateSmoothMove_Context::StateSmoothMove_Context(CanvasView* canvas_view):