From 2b7d889d90a36d42165dc5e322b058317d3673de Mon Sep 17 00:00:00 2001 From: dooglus Date: Sat, 22 Sep 2007 21:10:25 +0000 Subject: [PATCH] Fix 1800324: closing a window while an animation is playing crashes studio, so don't let the window close if it's playing. Instead we display a message explaining why the window won't close. It would be better if we could somehow cause the playback to stop and then close the window, but this is better than crashing. git-svn-id: http://svn.voria.com/code@738 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-studio/trunk/src/gtkmm/canvasview.h | 2 ++ synfig-studio/trunk/src/gtkmm/instance.cpp | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/synfig-studio/trunk/src/gtkmm/canvasview.h b/synfig-studio/trunk/src/gtkmm/canvasview.h index 1ba3dcf..87cd13c 100644 --- a/synfig-studio/trunk/src/gtkmm/canvasview.h +++ b/synfig-studio/trunk/src/gtkmm/canvasview.h @@ -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 ------------------------------------- */ diff --git a/synfig-studio/trunk/src/gtkmm/instance.cpp b/synfig-studio/trunk/src/gtkmm/instance.cpp index 9ac76fb..0c0f7ac 100644 --- a/synfig-studio/trunk/src/gtkmm/instance.cpp +++ b/synfig-studio/trunk/src/gtkmm/instance.cpp @@ -643,9 +643,17 @@ Instance::safe_revert() bool Instance::safe_close() { - handle uim; - uim=find_canvas_view(get_canvas())->get_ui_interface(); + handle canvas_view = find_canvas_view(get_canvas()); + handle 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 { -- 2.7.4