[Spice-devel] [PATCH spice-gtk v2 17/19] session: remove sticky disconnecting flag

Marc-André Lureau marcandre.lureau at redhat.com
Thu Nov 13 15:32:40 PST 2014


This used to help prevent double-unref when channel were considered part
of the session as long as they lived. Now it shouldn't be required
anymore
---
 gtk/spice-session.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/gtk/spice-session.c b/gtk/spice-session.c
index 5729d8a..cb23102 100644
--- a/gtk/spice-session.c
+++ b/gtk/spice-session.c
@@ -1295,12 +1295,11 @@ gboolean spice_session_connect(SpiceSession *session)
     SpiceSessionPrivate *s;
 
     g_return_val_if_fail(SPICE_IS_SESSION(session), FALSE);
-    g_return_val_if_fail(session->priv != NULL, FALSE);
 
     s = session->priv;
+    g_return_val_if_fail(!s->disconnecting, FALSE);
 
     spice_session_disconnect(session);
-    s->disconnecting = FALSE;
 
     s->client_provided_sockets = FALSE;
 
@@ -1330,13 +1329,12 @@ gboolean spice_session_open_fd(SpiceSession *session, int fd)
     SpiceSessionPrivate *s;
 
     g_return_val_if_fail(SPICE_IS_SESSION(session), FALSE);
-    g_return_val_if_fail(session->priv != NULL, FALSE);
     g_return_val_if_fail(fd >= -1, FALSE);
 
     s = session->priv;
+    g_return_val_if_fail(!s->disconnecting, FALSE);
 
     spice_session_disconnect(session);
-    s->disconnecting = FALSE;
 
     s->client_provided_sockets = TRUE;
 
@@ -1664,8 +1662,7 @@ void spice_session_disconnect(SpiceSession *session)
     memset(s->uuid, 0, sizeof(s->uuid));
 
     spice_session_abort_migration(session);
-    /* we leave disconnecting = TRUE, so that spice_channel_disconnect()
-       is not called multiple times */
+    s->disconnecting = FALSE;
 }
 
 /**
-- 
1.9.3



More information about the Spice-devel mailing list