[evolution-patches] 42617: crash apparently due to disposed drag_context



This patch switches from the 1.2 g_dataset context cleanup which AFAICT
never cleaned up anything, to a weak ref of the drag context that is
used by the scroll idle handler.

Mike
Index: gal/e-table/ChangeLog
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/ChangeLog,v
retrieving revision 1.896
diff -u -p -r1.896 ChangeLog
--- gal/e-table/ChangeLog	14 May 2003 17:56:49 -0000	1.896
+++ gal/e-table/ChangeLog	14 May 2003 19:50:08 -0000
@@ -1,3 +1,8 @@
+2003-05-14  Mike Kestner  <mkestner ximian com>
+
+	* e-tree-c (context_connect): use weak refs not datasets.
+	Hopefully fixes 42617.
+
 2003-05-13  Mike Kestner  <mkestner ximian com>
 
 	* e-table-item.c (eti_event): gross hack to work around a
Index: gal/e-table/e-tree.c
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/e-tree.c,v
retrieving revision 1.99
diff -u -p -r1.99 e-tree.c
--- gal/e-table/e-tree.c	9 May 2003 21:39:56 -0000	1.99
+++ gal/e-table/e-tree.c	14 May 2003 19:50:10 -0000
@@ -2806,7 +2806,7 @@ collapse_drag (ETree *et, ETreePath drop
 }
 
 static void
-context_destroyed (gpointer data)
+context_destroyed (gpointer data, GObject *ctx)
 {
 	ETree *et = data;
 	if (et->priv) {
@@ -2824,10 +2824,15 @@ context_destroyed (gpointer data)
 static void
 context_connect (ETree *et, GdkDragContext *context)
 {
-	if (g_dataset_get_data (context, "e-tree") == NULL) {
+	if (context == et->priv->last_drop_context)
+       		return;
+	
+	if (et->priv->last_drop_context) 
+		g_object_weak_unref (G_OBJECT(et->priv->last_drop_context), context_destroyed, et);
+	else
 		g_object_ref (et);
-		g_dataset_set_data_full (context, "e-tree", et, context_destroyed);
-	}
+
+	g_object_weak_ref (G_OBJECT(context), context_destroyed, et);
 }
 
 static void
@@ -2864,8 +2869,8 @@ et_drag_motion(GtkWidget *widget,
 	et->priv->last_drop_x = x;
 	et->priv->last_drop_y = y;
 	et->priv->last_drop_time = time;
-	et->priv->last_drop_context = context;
 	context_connect (et, context);
+	et->priv->last_drop_context = context;
 
 	if (et->priv->hover_idle_id != 0) {
 		if (abs (et->priv->hover_x - x) > 3 ||


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