Fix 1800324: closing a window while an animation is playing crashes studio, so don...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Sat, 22 Sep 2007 21:10:25 +0000 (21:10 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Sat, 22 Sep 2007 21:10:25 +0000 (21:10 +0000)
git-svn-id: http://svn.voria.com/code@738 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-studio/trunk/src/gtkmm/canvasview.h
synfig-studio/trunk/src/gtkmm/instance.cpp

index 1ba3dcf..87cd13c 100644 (file)
@@ -589,6 +589,8 @@ public:
 
        void present();
 
+       bool is_playing() { return is_playing_; }
+
        /*
  -- ** -- S I G N A L   T E R M I N A L S -------------------------------------
        */
index 9ac76fb..0c0f7ac 100644 (file)
@@ -643,9 +643,17 @@ Instance::safe_revert()
 bool
 Instance::safe_close()
 {
-       handle<synfigapp::UIInterface> uim;
-       uim=find_canvas_view(get_canvas())->get_ui_interface();
+       handle<CanvasView> canvas_view = find_canvas_view(get_canvas());
+       handle<synfigapp::UIInterface> uim=canvas_view->get_ui_interface();
 
+       // if the animation is currently playing, closing the window will cause a crash,
+       // so don't allow it
+       if (canvas_view->is_playing())
+       {
+               canvas_view->present();
+               App::dialog_error_blocking("Close Error", "The animation is currently playing so the window cannot be closed.");
+               return false;
+       }
        if(get_action_count())
                do
                {