MainChannelClient is used by other clients to store some data so should not disappear if other clients are still present. Keep a owning reference to it and release after RedClient is released. Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> --- server/red-client.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/red-client.c b/server/red-client.c index 36577dab..7e1394e5 100644 --- a/server/red-client.c +++ b/server/red-client.c @@ -108,6 +108,10 @@ red_client_finalize (GObject *object) { RedClient *self = RED_CLIENT(object); + if (self->mcc) { + g_object_unref(self->mcc); + self->mcc = NULL; + } spice_debug("release client=%p", self); pthread_mutex_destroy(&self->lock); @@ -314,7 +318,8 @@ MainChannelClient *red_client_get_main(RedClient *client) void red_client_set_main(RedClient *client, MainChannelClient *mcc) { - client->mcc = mcc; + spice_assert(client->mcc == NULL); + client->mcc = g_object_ref(mcc); } void red_client_semi_seamless_migrate_complete(RedClient *client) -- 2.13.5 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel