From 6d1332ac7513f564c36949ed5d95fd6874f8bbb2 Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Mon, 17 Dec 2012 14:22:48 +0000 Subject: Disconnect the clipboard signal handler on window close Previously, if a window was closed and then the clipboard changed, update_paste_action would still be called with a now-invalid paste action. --- tikzit/src/gtk/Window.m | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'tikzit/src/gtk/Window.m') diff --git a/tikzit/src/gtk/Window.m b/tikzit/src/gtk/Window.m index ea87b6c..c5e7654 100644 --- a/tikzit/src/gtk/Window.m +++ b/tikzit/src/gtk/Window.m @@ -124,6 +124,9 @@ static void update_paste_action (GtkClipboard *clipboard, GdkEvent *event, GtkAc - (void) dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; + g_signal_handler_disconnect ( + gtk_clipboard_get (GDK_SELECTION_CLIPBOARD), + clipboard_handler_id); [menu release]; [graphPanel release]; @@ -565,10 +568,11 @@ static void update_paste_action (GtkClipboard *clipboard, GdkEvent *event, GtkAc - (void) _connectSignals { GtkClipboard *clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD); - g_signal_connect (G_OBJECT (clipboard), - "owner-change", - G_CALLBACK (update_paste_action), - [menu pasteAction]); + clipboard_handler_id = + g_signal_connect (G_OBJECT (clipboard), + "owner-change", + G_CALLBACK (update_paste_action), + [menu pasteAction]); g_signal_connect (G_OBJECT (window), "key-press-event", G_CALLBACK (tz_hijack_key_press), -- cgit v1.2.3