[Spice-devel] [PATCH spice-gtk 1/2] gtk-session: ignore destroy of outdated main channel

Marc-André Lureau marcandre.lureau at gmail.com
Wed Jan 18 06:12:53 PST 2012


This solves clipboard sharing not working with a password protected
server, since new main channel are created for each connection
attempt.
---
 gtk/spice-gtk-session.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/gtk/spice-gtk-session.c b/gtk/spice-gtk-session.c
index 32848fa..a7357f8 100644
--- a/gtk/spice-gtk-session.c
+++ b/gtk/spice-gtk-session.c
@@ -743,6 +743,7 @@ static void channel_new(SpiceSession *session, SpiceChannel *channel,
     SpiceGtkSessionPrivate *s = self->priv;
 
     if (SPICE_IS_MAIN_CHANNEL(channel)) {
+        SPICE_DEBUG("Changing main channel from %p to %p", s->main, channel);
         s->main = SPICE_MAIN_CHANNEL(channel);
         g_signal_connect(channel, "main-clipboard-selection-grab",
                          G_CALLBACK(clipboard_grab), self);
@@ -762,7 +763,7 @@ static void channel_destroy(SpiceSession *session, SpiceChannel *channel,
     SpiceGtkSessionPrivate *s = self->priv;
     guint i;
 
-    if (SPICE_IS_MAIN_CHANNEL(channel)) {
+    if (SPICE_IS_MAIN_CHANNEL(channel) && SPICE_MAIN_CHANNEL(channel) == s->main) {
         s->main = NULL;
         for (i = 0; i < CLIPBOARD_LAST; ++i) {
             if (s->clipboard_by_guest[i]) {
-- 
1.7.7.5



More information about the Spice-devel mailing list