[gnumeric] GUI: Try to work around a crash we think is caused by gtk.



commit 311bc717827e6040124a91bb5bdc3dfc70e9eae5
Author: Morten Welinder <terra gnome org>
Date:   Tue Apr 17 11:18:23 2012 -0400

    GUI: Try to work around a crash we think is caused by gtk.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=803904
    
    We get signals at shutdown time for widgets that gtk+ should have
    destroyed and freed.

 ChangeLog     |    5 +++++
 NEWS          |    1 +
 src/wbc-gtk.c |   29 +++++++++++++++++++++++++----
 3 files changed, 31 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7edbe41..b104ee0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-04-17  Morten Welinder  <terra gnome org>
+
+	* src/wbc-gtk.c (cb_font_name_changed, cb_font_size_changed)
+	(cb_zoom_activated): Try working around gtk bug.
+
 2012-04-06  Morten Welinder  <terra gnome org>
 
 	* src/search.c (gnm_search_normalize): Function to normalize text
diff --git a/NEWS b/NEWS
index 535bc98..cb1d633 100644
--- a/NEWS
+++ b/NEWS
@@ -53,6 +53,7 @@ Morten:
 	* Enable MATCH/VLOOKUP/HLOOKUP caches during redraw.
 	* Speed-up some operations on large areas.
 	* Work around pango bug affecting search/replace.  [#673447]
+	* Try to work around gtk bug causing crashes.  [Redhat #803904]
 
 --------------------------------------------------------------------------
 Gnumeric 1.11.2
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index 3a0cacb..6269117 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -2905,13 +2905,15 @@ static GNM_ACTION_DEF (cb_zoom_activated)
 {
 	WorkbookControl *wbc = (WorkbookControl *)wbcg;
 	Sheet *sheet = wb_control_cur_sheet (wbc);
-	char const *new_zoom = go_action_combo_text_get_entry (wbcg->zoom_haction);
+	char const *new_zoom;
 	int factor;
 	char *end;
 
-	if (sheet == NULL || wbcg->updating_ui)
+	if (sheet == NULL || wbcg->updating_ui || wbcg->snotebook == NULL)
 		return;
 
+	new_zoom = go_action_combo_text_get_entry (wbcg->zoom_haction);
+
 	errno = 0; /* strtol sets errno, but does not clear it.  */
 	factor = strtol (new_zoom, &end, 10);
 	if (new_zoom != end && errno != ERANGE && factor == (gnm_float)factor)
@@ -3316,7 +3318,17 @@ wbc_gtk_init_color_back (WBCGtk *gtk)
 static void
 cb_font_name_changed (GOActionComboText *a, WBCGtk *gtk)
 {
-	char const *new_name = go_action_combo_text_get_entry (gtk->font_name);
+	char const *new_name;
+
+	/*
+	 * Ignore events during destruction.  This is an attempt at avoiding
+	 * https://bugzilla.redhat.com/show_bug.cgi?id=803904 for which we
+	 * blame gtk.
+	 */
+	if (gtk->snotebook == NULL)
+		return;
+
+	new_name = go_action_combo_text_get_entry (gtk->font_name);
 
 	while (g_ascii_isspace (*new_name))
 		++new_name;
@@ -3374,10 +3386,19 @@ wbc_gtk_init_font_name (WBCGtk *gtk)
 static void
 cb_font_size_changed (GOActionComboText *a, WBCGtk *gtk)
 {
-	char const *new_size = go_action_combo_text_get_entry (gtk->font_size);
+	char const *new_size;
 	char *end;
 	double size;
 
+	/*
+	 * Ignore events during destruction.  This is an attempt at avoiding
+	 * https://bugzilla.redhat.com/show_bug.cgi?id=803904 for which we
+	 * blame gtk.
+	 */
+	if (gtk->snotebook == NULL)
+		return;
+
+	new_size = go_action_combo_text_get_entry (gtk->font_size);
 	size = go_strtod (new_size, &end);
 	size = floor ((size * 20.) + .5) / 20.;	/* round .05 */
 



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