X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Fcanvasview.cpp;h=b88484f9051baae1af7114d1401f98721913c443;hb=c3a7f7ac4d1f045c134877baa3b84a4b2aa34287;hp=9f4860e36ec5561c4e7b82205128b4a063e919a9;hpb=bface46565b5e8d219a51cab190e0735920c8b16;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/canvasview.cpp b/synfig-studio/trunk/src/gtkmm/canvasview.cpp index 9f4860e..b88484f 100644 --- a/synfig-studio/trunk/src/gtkmm/canvasview.cpp +++ b/synfig-studio/trunk/src/gtkmm/canvasview.cpp @@ -1942,7 +1942,16 @@ CanvasView::refresh_rend_desc() bool CanvasView::close() { - get_instance()->safe_close(); + if (get_work_area()->get_updating()) + { + get_work_area()->stop_updating(true); // stop and mark as cancelled + + // give the workarea chances to stop updating + Glib::signal_timeout().connect(sigc::mem_fun(*this, &CanvasView::close_instance_when_safe) ,250); + return false; + } + + close_instance_when_safe(); return false; } @@ -3526,10 +3535,12 @@ static bool _close_instance(etl::handle instance) } bool -CanvasView::on_delete_event(GdkEventAny* event) +CanvasView::close_instance_when_safe() { + if (get_work_area()->get_updating()) + return true; + if(get_instance()->get_visible_canvases()==1) - { // Schedule a close to occur in a few moments Glib::signal_timeout().connect( sigc::bind( @@ -3538,7 +3549,14 @@ CanvasView::on_delete_event(GdkEventAny* event) ) ,250 ); - } + + return false; +} + +bool +CanvasView::on_delete_event(GdkEventAny* event) +{ + close(); //! \todo This causes the window to be deleted straight away - but what if we prompt 'save?' and the user cancels? // Is there ever any need to pass on the delete event to the window here?