From e13eb3724dadd1b9dfcd108317e6c39a15c748d2 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 16 Mar 2015 22:43:30 +0000 Subject: Fix removal of non-existent idle callbacks. git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@5638 a436a847-0d15-0410-975c-d299462d15a1 --- src/Canvas.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Canvas.cpp b/src/Canvas.cpp index 0adc78a..a30657b 100644 --- a/src/Canvas.cpp +++ b/src/Canvas.cpp @@ -268,8 +268,12 @@ struct GanvCanvasImpl { ~GanvCanvasImpl() { - g_source_remove(_animate_idle_id); - while (g_idle_remove_by_data(this)) ; + if (_animate_idle_id) { + g_source_remove(_animate_idle_id); + _animate_idle_id = 0; + } + + while (g_idle_remove_by_data(this)) {} ganv_canvas_clear(_gcanvas); gdk_cursor_unref(_move_cursor); } @@ -2879,7 +2883,10 @@ ganv_canvas_unrealize(GtkWidget* widget) GanvCanvas* canvas = GANV_CANVAS(widget); - g_source_remove(canvas->impl->_animate_idle_id); + if (canvas->impl->_animate_idle_id) { + g_source_remove(canvas->impl->_animate_idle_id); + canvas->impl->_animate_idle_id = 0; + } while (g_idle_remove_by_data(canvas->impl)) {} shutdown_transients(canvas); -- cgit v1.2.1