[Spice-devel] [spice-gtk v1 2/3] main: migration: check return value to count channels

Victor Toso victortoso at redhat.com
Wed Sep 4 12:20:40 UTC 2019


From: Victor Toso <me at victortoso.com>

Although spice_channel_connect() works in idle, if it returns false
it'll not emit any signal further and we would be counting a
'connected' channel that wouldn't be emitting anything.

As other callbacks take this in consideration, we should only
increment the counter if we reached spice-channel::connect_delayed()
callback.

Signed-off-by: Victor Toso <victortoso at redhat.com>
---
 src/channel-main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/channel-main.c b/src/channel-main.c
index a1e5498..3d1b1b5 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -2174,8 +2174,9 @@ migrate_channel_connect(spice_migrate *mig, int type, int id)
     SPICE_DEBUG("migrate_channel_connect %d:%d", type, id);
 
     SpiceChannel *newc = spice_channel_new(mig->session, type, id);
-    spice_channel_connect(newc);
-    mig->nchannels++;
+    if (newc != NULL && spice_channel_connect(newc)) {
+        mig->nchannels++;
+    }
 }
 
 /* coroutine context */
-- 
2.21.0



More information about the Spice-devel mailing list