summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Canvas.cpp13
1 files 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);