aboutsummaryrefslogtreecommitdiffstats
path: root/main/remmina/remmina-1.0.0-disconnect-signal-handler-after-disconnect.patch
blob: dc4ae33310145f08ae89f49506674f5116e679c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From c1ef3a162622942d7c556c5a4352e626c7bcb28f Mon Sep 17 00:00:00 2001
From: Jean-Louis Dupond <jean-louis@dupond.be>
Date: Tue, 8 May 2012 14:44:16 +0200
Subject: [PATCH] Disconnect signal handler after disconnect

---
 remmina-plugins/rdp/rdp_event.c  |   10 ++++++++--
 remmina-plugins/rdp/rdp_plugin.h |    1 +
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/remmina-plugins/rdp/rdp_event.c b/remmina-plugins/rdp/rdp_event.c
index a936fb1..2c050c6 100644
--- a/remmina-plugins/rdp/rdp_event.c
+++ b/remmina-plugins/rdp/rdp_event.c
@@ -523,8 +523,7 @@ void remmina_rdp_event_init(RemminaProtocolWidget* gp)
 	if (!remmina_plugin_service->file_get_int(remminafile, "disableclipboard", FALSE))
 	{
 		clipboard = gtk_widget_get_clipboard(rfi->drawing_area, GDK_SELECTION_CLIPBOARD);
-		g_signal_connect(clipboard, "owner-change",
-			G_CALLBACK(remmina_rdp_event_on_clipboard), gp);
+		rfi->clipboard_handler = g_signal_connect(clipboard, "owner-change", G_CALLBACK(remmina_rdp_event_on_clipboard), gp);
 	}
 
 	rfi->pressed_keys = g_array_new(FALSE, TRUE, sizeof (gint));
@@ -575,6 +574,13 @@ void remmina_rdp_event_uninit(RemminaProtocolWidget* gp)
 
 	rfi = GET_DATA(gp);
 
+
+	/* unregister the clipboard monitor */
+	if (rfi->clipboard_handler)
+	{
+		g_signal_handler_disconnect(G_OBJECT(gtk_widget_get_clipboard(rfi->drawing_area, GDK_SELECTION_CLIPBOARD)), rfi->clipboard_handler);
+		rfi->clipboard_handler = NULL;
+	}
 	if (rfi->scale_handler)
 	{
 		g_source_remove(rfi->scale_handler);
diff --git a/remmina-plugins/rdp/rdp_plugin.h b/remmina-plugins/rdp/rdp_plugin.h
index ff66906..08b8891 100644
--- a/remmina-plugins/rdp/rdp_plugin.h
+++ b/remmina-plugins/rdp/rdp_plugin.h
@@ -134,6 +134,7 @@ struct rf_context
 	GAsyncQueue* event_queue;
 	gint event_pipe[2];
 
+	gint clipboard_handler;
 	gint clipboard_wait;
 	uint32 requested_format;
 };
-- 
1.7.10