[gnumeric] GUI: ensure we don't leave a timer for deleted control



commit 89f2aee8ab95fe3c827ddf7b0bc6b40c6805e7a4
Author: Morten Welinder <terra gnome org>
Date:   Thu Nov 30 08:43:05 2017 -0500

    GUI: ensure we don't leave a timer for deleted control

 NEWS                         |    1 +
 src/sheet-control-gui-priv.h |    1 +
 src/sheet-control-gui.c      |   17 +++++++++++++----
 3 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/NEWS b/NEWS
index 55b300a..4575e65 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ Morten:
        * Speed-up number theory functions.
        * Fix combo object icon.
        * Code cleanups for main binary.
+       * Fix potential crash in gtk scroll bar bug workaround.
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.36
diff --git a/src/sheet-control-gui-priv.h b/src/sheet-control-gui-priv.h
index 143c32f..d2290dc 100644
--- a/src/sheet-control-gui-priv.h
+++ b/src/sheet-control-gui-priv.h
@@ -36,6 +36,7 @@ struct _SheetControlGUI {
        int              vpos, hpos;    /* Handle positions */
        guint            pane_drag_handler;
        int              screen_width, screen_height;
+       guint            scroll_bar_timer;
 
        /* SheetObject support */
        GHashTable       *selected_objects;
diff --git a/src/sheet-control-gui.c b/src/sheet-control-gui.c
index ac2912b..ecd2286 100644
--- a/src/sheet-control-gui.c
+++ b/src/sheet-control-gui.c
@@ -514,17 +514,21 @@ scg_scrollbar_config_real (SheetControl const *sc)
                         MAX (gtk_adjustment_get_page_size (ha) - 3.0, 1.0),
                         last_col - pane->first.col + 1);
        }
+
+       scg->scroll_bar_timer = 0;
        return FALSE;
 }
 
 
 static void
-scg_scrollbar_config (SheetControl const *sc)
+scg_scrollbar_config (SheetControlGUI *scg)
 {
        /* See bug 789412 */
-       g_timeout_add (1,
-                      (GSourceFunc) scg_scrollbar_config_real,
-                      (gpointer)sc);
+       if (!scg->scroll_bar_timer)
+               scg->scroll_bar_timer =
+                       g_timeout_add (1,
+                                      (GSourceFunc) scg_scrollbar_config_real,
+                                      scg);
 }
 
 void
@@ -1844,6 +1848,11 @@ scg_finalize (GObject *object)
                scg->pane_drag_handler = 0;
        }
 
+       if (scg->scroll_bar_timer) {
+               g_source_remove (scg->scroll_bar_timer);
+               scg->scroll_bar_timer = 0;
+       }
+
        scg_comment_timer_clear (scg);
 
        if (scg->delayedMovement.timer != 0) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]