summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2012-03-04 19:02:31 +0100
committerHans de Goede <hdegoede@redhat.com>2012-03-06 12:55:30 +0100
commit8ec03e50974330c3813df68e16b38702e216f9fd (patch)
tree51e350759803d327e481a3e378e51924922e1137
parent93eae5c49de00c01a5165e9736ba82ba1dd0570c (diff)
virt_viewer_app_quit: Cleanly close the connection before quiting
Even though the previous patches in this series ensure that the session gets properly finalized, we still need to wait for the disconnect signal, as spice-glib uses co-routines which need some time to cleanly close the connection / session. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--src/virt-viewer-app.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index 2a66142..49b50d4 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -117,6 +117,7 @@ struct _VirtViewerAppPrivate {
gboolean started;
gboolean fullscreen;
gboolean attach;
+ gboolean quiting;
VirtViewerSession *session;
gboolean active;
@@ -209,8 +210,14 @@ virt_viewer_app_quit(VirtViewerApp *self)
g_return_if_fail(VIRT_VIEWER_IS_APP(self));
VirtViewerAppPrivate *priv = self->priv;
- if (priv->session)
+ if (priv->session) {
virt_viewer_session_close(VIRT_VIEWER_SESSION(priv->session));
+ if (priv->connected) {
+ priv->quiting = TRUE;
+ return;
+ }
+ }
+
gtk_main_quit();
}
@@ -1055,6 +1062,9 @@ virt_viewer_app_disconnected(VirtViewerSession *session G_GNUC_UNUSED,
{
VirtViewerAppPrivate *priv = self->priv;
+ if (priv->quiting)
+ gtk_main_quit();
+
if (!priv->connected && !priv->cancelled) {
virt_viewer_app_simple_message_dialog(self,
_("Unable to connect to the graphic server %s"),