[PATCH spice-gtk] smartcard: connect object signal handlers with spice helper

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

 



The smartcard manager may outlive the smartcard channels. Make sure the
channel handlers are disconnected when the channel is free by using
spice_g_signal_connect_object() helper. This fixes crashes when
dispatching smartcard events on deleted channels.

Related bug:
https://bugzilla.redhat.com/show_bug.cgi?id=1205171
---
 gtk/channel-smartcard.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/gtk/channel-smartcard.c b/gtk/channel-smartcard.c
index 8588ae0..cc3ae3b 100644
--- a/gtk/channel-smartcard.c
+++ b/gtk/channel-smartcard.c
@@ -140,14 +140,14 @@ static void spice_smartcard_channel_constructed(GObject *object)
         SpiceSmartcardChannel *channel = SPICE_SMARTCARD_CHANNEL(object);
         SpiceSmartcardManager *manager = spice_smartcard_manager_get();
 
-        g_signal_connect(G_OBJECT(manager), "reader-added",
-                         (GCallback)reader_added_cb, channel);
-        g_signal_connect(G_OBJECT(manager), "reader-removed",
-                         (GCallback)reader_removed_cb, channel);
-        g_signal_connect(G_OBJECT(manager), "card-inserted",
-                         (GCallback)card_inserted_cb, channel);
-        g_signal_connect(G_OBJECT(manager), "card-removed",
-                         (GCallback)card_removed_cb, channel);
+        spice_g_signal_connect_object(G_OBJECT(manager), "reader-added",
+                                      (GCallback)reader_added_cb, channel, 0);
+        spice_g_signal_connect_object(G_OBJECT(manager), "reader-removed",
+                                      (GCallback)reader_removed_cb, channel, 0);
+        spice_g_signal_connect_object(G_OBJECT(manager), "card-inserted",
+                                      (GCallback)card_inserted_cb, channel, 0);
+        spice_g_signal_connect_object(G_OBJECT(manager), "card-removed",
+                                      (GCallback)card_removed_cb, channel, 0);
     }
 #endif
 
-- 
2.1.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]