[nautilus/gnome-3-6] slot: make sure we have signal handlers before disconnecting them



commit bbcd352e9f8a137156650be0ebd8c39f0c113e47
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue Oct 2 15:42:54 2012 -0400

    slot: make sure we have signal handlers before disconnecting them
    
    This makes the code more robust in case it's called e.g. with visible =
    FALSE on a slot that already has the query editor hidden.

 src/nautilus-window-slot.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index bdf3a3e..aaa567a 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -239,12 +239,20 @@ nautilus_window_slot_set_query_editor_visible (NautilusWindowSlot *slot,
 
 	} else {
 		gtk_widget_hide (GTK_WIDGET (slot->query_editor));
-		g_signal_handler_disconnect (slot->query_editor, slot->qe_changed_id);
-		slot->qe_changed_id = 0;
-		g_signal_handler_disconnect (slot->query_editor, slot->qe_cancel_id);
-		slot->qe_cancel_id = 0;
-		g_signal_handler_disconnect (slot->query_editor, slot->qe_activated_id);
-		slot->qe_activated_id = 0;
+
+		if (slot->qe_changed_id > 0) {
+			g_signal_handler_disconnect (slot->query_editor, slot->qe_changed_id);
+			slot->qe_changed_id = 0;
+		}
+		if (slot->qe_cancel_id > 0) {
+			g_signal_handler_disconnect (slot->query_editor, slot->qe_cancel_id);
+			slot->qe_cancel_id = 0;
+		}
+		if (slot->qe_activated_id > 0) {
+			g_signal_handler_disconnect (slot->query_editor, slot->qe_activated_id);
+			slot->qe_activated_id = 0;
+		}
+
 		nautilus_query_editor_set_query (slot->query_editor, NULL);
 	}
 }



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