clipboard_get() exits when the clipboard data is received, or when the agent connection state change. However, if the agent is already disconnected, neither of those 2 conditions can be reached. Check agent is connected before running loop, exit early if not. --- gtk/spice-gtk-session.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gtk/spice-gtk-session.c b/gtk/spice-gtk-session.c index af491d2..71ed300 100644 --- a/gtk/spice-gtk-session.c +++ b/gtk/spice-gtk-session.c @@ -615,6 +615,7 @@ static void clipboard_get(GtkClipboard *clipboard, RunInfo ri = { NULL, }; SpiceGtkSession *self = user_data; SpiceGtkSessionPrivate *s = self->priv; + gboolean agent_connected = FALSE; gulong clipboard_handler; gulong agent_handler; int selection; @@ -642,12 +643,20 @@ static void clipboard_get(GtkClipboard *clipboard, spice_main_clipboard_selection_request(s->main, selection, atom2agent[info].vdagent); + + g_object_get(s->main, "agent-connected", &agent_connected, NULL); + if (!agent_connected) { + SPICE_DEBUG("canceled clipboard_get, before running loop"); + goto cleanup; + } + /* apparently, this is needed to avoid dead-lock, from gtk_dialog_run */ gdk_threads_leave(); g_main_loop_run(ri.loop); gdk_threads_enter(); +cleanup: g_main_loop_unref(ri.loop); ri.loop = NULL; g_signal_handler_disconnect(s->main, clipboard_handler); -- 1.8.3.1 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel