From 33bedf5ba9745b8da8ed629e9c1ea57313c87a82 Mon Sep 17 00:00:00 2001 From: dooglus Date: Wed, 26 Sep 2007 16:59:45 +0000 Subject: [PATCH] I thought this should prevent a crash, but it doesn't. __render_preview is still being called after the WorkArea has been deleted. Why? git-svn-id: http://svn.voria.com/code@766 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-studio/trunk/src/gtkmm/workarea.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/synfig-studio/trunk/src/gtkmm/workarea.cpp b/synfig-studio/trunk/src/gtkmm/workarea.cpp index 14a54c0..dce50cd 100644 --- a/synfig-studio/trunk/src/gtkmm/workarea.cpp +++ b/synfig-studio/trunk/src/gtkmm/workarea.cpp @@ -800,6 +800,15 @@ WorkArea::WorkArea(etl::loose_handle canvas_interfac WorkArea::~WorkArea() { // delete [] buffer; + + // don't leave the render function queued if we are about to vanish; + // that causes crashes + if(render_idle_func_id) + { + synfig::info("g_source_remove() returns %d", g_source_remove(render_idle_func_id)); + render_idle_func_id=0; + } else + synfig::info("no render_idle_func_id to clear\n"); } void @@ -2497,9 +2506,11 @@ studio::WorkArea::zoom_norm() gboolean studio::WorkArea::__render_preview(gpointer data) { - WorkArea *work_area(static_cast(data)); + // there's no point anyone trying to cancel the timer now - it's gone off already + work_area->render_idle_func_id = 0; + work_area->queued=false; work_area->async_render_preview(work_area->get_canvas_view()->get_time()); -- 2.7.4