[gnumeric] GUI: Fix potential crash.



commit a5be2a5db3d92909906efe8f118ac35993b03751
Author: Morten Welinder <terra gnome org>
Date:   Mon Feb 21 10:24:34 2011 -0500

    GUI: Fix potential crash.

 ChangeLog          |    5 +++++
 NEWS               |    1 +
 src/wbc-gtk-impl.h |    2 ++
 src/wbc-gtk.c      |    9 ++++++++-
 4 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 32f20da..42c02a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-02-21  Morten Welinder  <terra gnome org>
+
+	* src/wbc-gtk.c (wbc_gtk_finalize): Cancel template loader handler
+	if necessary.
+
 2011-02-17  Morten Welinder  <terra gnome org>
 
 	* src/wbc-gtk.c (wbc_gtk_finalize): Remove custum UIs.
diff --git a/NEWS b/NEWS
index 796ae91..0244c9c 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,7 @@ Morten:
 	* Import wide sc files.  [#641581]
 	* Fix problem with single-cell names and 'r'-type arguments.  [#613273]
 	* Plug a few leaks.
+	* Fix potential crash on quick exit.
 
 --------------------------------------------------------------------------
 Gnumeric 1.10.13
diff --git a/src/wbc-gtk-impl.h b/src/wbc-gtk-impl.h
index a5fe235..36b87a4 100644
--- a/src/wbc-gtk-impl.h
+++ b/src/wbc-gtk-impl.h
@@ -114,6 +114,8 @@ struct _WBCGtk {
 		guint		  merge_id;
 	} file_history, toolbar, windows, templates;
 
+	guint template_loader_handler;
+
 	GOActionComboStack	*undo_haction, *redo_haction;
 	GtkAction		*undo_vaction, *redo_vaction;
 	GOActionComboColor	*fore_color, *back_color;
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index 9d61513..24586f2 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -5148,6 +5148,7 @@ wbc_gtk_load_templates (WBCGtk *wbcg)
 		wbc_gtk_reload_templates (wbcg);
 	}
 
+	wbcg->template_loader_handler = 0;
 	return FALSE;
 }
 
@@ -5247,6 +5248,11 @@ wbc_gtk_finalize (GObject *obj)
 	if (wbcg->idle_update_style_feedback != 0)
 		g_source_remove (wbcg->idle_update_style_feedback);
 
+	if (wbcg->template_loader_handler != 0) {
+		g_source_remove (wbcg->template_loader_handler);
+		wbcg->template_loader_handler = 0;
+	}
+
 	if (wbcg->file_history.merge_id != 0)
 		gtk_ui_manager_remove_ui (wbcg->ui, wbcg->file_history.merge_id);
 	UNREF_OBJ (file_history.actions);
@@ -5990,7 +5996,8 @@ wbc_gtk_new (WorkbookView *optional_view,
 	   updated right then -- and that looks sub-optimal because the
 	   "Templates" menu is empty (and thus not shown) until the
 	   update is done. */
-	g_timeout_add (1000, (GSourceFunc)wbc_gtk_load_templates, wbcg);
+	wbcg->template_loader_handler =
+		g_timeout_add (1000, (GSourceFunc)wbc_gtk_load_templates, wbcg);
 
 	wb_control_init_state (wbc);
 	return wbcg;



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