From 0cb2f7634a5ddaefc115181ba76702378007b5c4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@gmail.com>
Date: Fri, 20 May 2016 15:45:43 +0200
Subject: [PATCH 19/19] channel: check if channel has a session
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Since 8943d2329, the channel may be disconnected from the session
before it's destroyed. In this case, session is NULL.
Fixes some critical with virt-manager when closing a display:
(virt-manager:20451): GSpice-CRITICAL **: spice_session_is_for_migration: assertion 'SPICE_IS_SESSION(session)' failed
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
(cherry picked from commit 73564cc1007a7c14e6c79dec67e99458de359898)
---
src/spice-channel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/spice-channel.c b/src/spice-channel.c
index fdc0e97..0d9e85a 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -2314,7 +2314,7 @@ static gboolean spice_channel_delayed_unref(gpointer data)
c->state = SPICE_CHANNEL_STATE_UNCONNECTED;
session = spice_channel_get_session(channel);
- if (spice_session_is_for_migration(session)) {
+ if (session && spice_session_is_for_migration(session)) {
/* error during migration - abort migration */
spice_session_abort_migration(session);
return FALSE;
--
2.9.2