[virt-tools-list] [PATCH virt-viewer 2/3] spice-session: use a more robust signal connect

Marc-André Lureau marcandre.lureau at gmail.com
Fri May 17 12:28:10 UTC 2013


The Spice session may outlive the virt-viewer session, due to it's async
nature. Use the more robust virt_viewer_signal_connect_object() to fix
delayed potential crashes.
---
 src/virt-viewer-session-spice.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
index d7b01a7..06e0005 100644
--- a/src/virt-viewer-session-spice.c
+++ b/src/virt-viewer-session-spice.c
@@ -194,10 +194,10 @@ create_spice_session(VirtViewerSessionSpice *self)
     self->priv->gtk_session = spice_gtk_session_get(self->priv->session);
     g_object_set(self->priv->gtk_session, "auto-clipboard", TRUE, NULL);
 
-    g_signal_connect(self->priv->session, "channel-new",
-                     G_CALLBACK(virt_viewer_session_spice_channel_new), self);
-    g_signal_connect(self->priv->session, "channel-destroy",
-                     G_CALLBACK(virt_viewer_session_spice_channel_destroy), self);
+    virt_viewer_signal_connect_object(self->priv->session, "channel-new",
+        G_CALLBACK(virt_viewer_session_spice_channel_new), self, 0);
+    virt_viewer_signal_connect_object(self->priv->session, "channel-destroy",
+        G_CALLBACK(virt_viewer_session_spice_channel_destroy), self, 0);
 
     manager = spice_usb_device_manager_get(self->priv->session, NULL);
     if (manager) {
-- 
1.8.3.rc1.49.g8d97506




More information about the virt-tools-list mailing list