[gnumeric] Graph editor: fix crash.



commit fb020ba6bb6c150c4bc315c4b11b101c93fba35f
Author: Morten Welinder <terra gnome org>
Date:   Wed Dec 9 19:26:18 2009 -0500

    Graph editor: fix crash.

 ChangeLog     |    9 +++++++--
 NEWS          |    1 +
 src/wbc-gtk.c |   16 +++++++++++++++-
 3 files changed, 23 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b0dec14..4c8a413 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,13 @@
+2009-12-09  Morten Welinder  <terra gnome org>
+
+	* src/wbc-gtk.c (graph_dim_cancel_idle): New function.
+	(graph_dim_editor_free): Cancel idle handler.  Fixes #604223.
+
 2009-12-09  Andreas J. Guelzow <aguelzow pyrshep ca>
-	
+
 	* src/workbook-view.c (wbv_save_to_output): update modification time
 	  only when we in fact modified the file.
-	
+
 2009-12-09  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* src/gutils.c (gnm_insert_meta_date): new
diff --git a/NEWS b/NEWS
index 083163a..eee5c10 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,7 @@ Morten:
 	* Automate solver testing.
 	* Fix SUMIF problem.  [#603671]
 	* Fix DATEDIF problem across bogus 1900-02-29.  [#599461]
+	* Fix graph editor crash.  [#604223]
 
 --------------------------------------------------------------------------
 Gnumeric 1.9.16
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index 7df68ab..d6cdf0a 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -59,6 +59,7 @@
 
 #include <goffice/goffice.h>
 #include <gsf/gsf-impl-utils.h>
+#include <gsf/gsf-doc-meta-data.h>
 #include <gtk/gtk.h>
 #include "gdk/gdkkeysyms.h"
 #include <glib/gi18n-lib.h>
@@ -4666,6 +4667,7 @@ typedef struct {
 
 	gulong dataset_changed_handler;
 	gulong entry_update_handler;
+	guint idle;
 } GraphDimEditor;
 
 static void
@@ -4742,6 +4744,15 @@ cb_update_idle (GraphDimEditor *editor)
 	return FALSE;
 }
 
+static void
+graph_dim_cancel_idle (GraphDimEditor *editor)
+{
+	if (editor->idle) {
+		g_source_remove (editor->idle);
+		editor->idle = 0;
+	}
+}
+
 static gboolean
 cb_graph_dim_entry_focus_out_event (G_GNUC_UNUSED GtkEntry	*ignored,
 				    G_GNUC_UNUSED GdkEventFocus	*event,
@@ -4749,7 +4760,8 @@ cb_graph_dim_entry_focus_out_event (G_GNUC_UNUSED GtkEntry	*ignored,
 {
 	if (!editor->changed)
 		return FALSE;
-	g_idle_add ((GSourceFunc) cb_update_idle, editor);
+	graph_dim_cancel_idle (editor);
+	editor->idle = g_idle_add ((GSourceFunc) cb_update_idle, editor);
 
 	return FALSE;
 }
@@ -4797,6 +4809,7 @@ cb_dim_editor_weakref_notify (GraphDimEditor *editor, GogDataset *dataset)
 static void
 graph_dim_editor_free (GraphDimEditor *editor)
 {
+	graph_dim_cancel_idle (editor);
 	if (editor->dataset) {
 		g_signal_handler_disconnect (editor->dataset, editor->dataset_changed_handler);
 		g_object_weak_unref (G_OBJECT (editor->dataset),
@@ -4819,6 +4832,7 @@ wbcg_data_allocator_editor (GogDataAllocator *dalloc,
 	editor->suppress_update = FALSE;
 	editor->data_type	= data_type;
 	editor->entry		= gnm_expr_entry_new (wbcg, TRUE);
+	editor->idle            = 0;
 	g_object_weak_ref (G_OBJECT (editor->dataset),
 		(GWeakNotify) cb_dim_editor_weakref_notify, editor);
 



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