[Spice-devel] [PATCH spice-server 4/4] red-client: Make sure MainChannelClient is freed as last
Frediano Ziglio
fziglio at redhat.com
Wed Aug 30 12:51:28 UTC 2017
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 at redhat.com>
---
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
More information about the Spice-devel
mailing list