Re: [PATCH] Disconnect possible registered destroy callback on eel cancellation dialog



On Wed, 2006-01-11 at 21:38 +0100, Christian Neumair wrote:
> The attached not seriously tested patch is meant to fix bug 302735 [1].
> 
> [1] http://bugzilla.gnome.org/show_bug.cgi?id=302735

We already protect against internal double free by the:
g_signal_handlers_disconnect_by_func (G_OBJECT (wait->dialog),
		G_CALLBACK(timed_wait_dialog_destroy_callback),
		wait);
call.

I think what happens is that eel_timed_wait_stop() gets called twice,
once from the initial stop when the operation was done and once from the
cancel callback when the user happened to click on cancel.

Could you test the attached patch instead?

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a suave vegetarian messiah on a mission from God. She's a virginal 
paranoid queen of the dead with a song in her heart and a spring in her step. 
They fight crime! 
Index: src/file-manager/fm-error-reporting.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-error-reporting.c,v
retrieving revision 1.40
diff -u -p -r1.40 fm-error-reporting.c
--- src/file-manager/fm-error-reporting.c	12 Dec 2005 16:59:11 -0000	1.40
+++ src/file-manager/fm-error-reporting.c	12 Jan 2006 11:59:33 -0000
@@ -36,7 +36,7 @@
 #define NEW_NAME_TAG "Nautilus: new name"
 #define MAXIMUM_DISPLAYED_FILE_NAME_LENGTH	50
 
-static void cancel_rename (NautilusFile *file);
+static void cancel_rename (NautilusFile *file, gboolean stop_timer);
 
 void
 fm_report_error_loading_directory (NautilusFile *file,
@@ -264,17 +264,17 @@ rename_callback (NautilusFile *file, Gno
 	/* If rename failed, notify the user. */
 	fm_report_error_renaming_file (file, name, result, NULL);
 
-	cancel_rename (file);
+	cancel_rename (file, TRUE);
 }
 
 static void
 cancel_rename_callback (gpointer callback_data)
 {
-	cancel_rename (NAUTILUS_FILE (callback_data));
+	cancel_rename (NAUTILUS_FILE (callback_data), FALSE);
 }
 
 static void
-cancel_rename (NautilusFile *file)
+cancel_rename (NautilusFile *file, gboolean stop_timer)
 {
 	char *name;
 
@@ -285,7 +285,9 @@ cancel_rename (NautilusFile *file)
 
 	/* Cancel both the rename and the timed wait. */
 	nautilus_file_cancel (file, rename_callback, NULL);
-	eel_timed_wait_stop (cancel_rename_callback, file);
+	if (stop_timer) {
+		eel_timed_wait_stop (cancel_rename_callback, file);
+	}
 
 	/* Let go of file name. */
 	g_object_set_data (G_OBJECT (file), NEW_NAME_TAG, NULL);
@@ -301,7 +303,7 @@ fm_rename_file (NautilusFile *file,
 	g_return_if_fail (new_name != NULL);
 
 	/* Stop any earlier rename that's already in progress. */
-	cancel_rename (file);
+	cancel_rename (file, TRUE);
 
 	/* Attach the new name to the file. */
 	g_object_set_data_full (G_OBJECT (file),


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