red-qxl: Reference RCC pointer in migration request

The message is asynchronous so to avoid the object to potentially
been released before being processed keep a strong reference to
it.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
This commit is contained in:
Frediano Ziglio 2017-08-31 05:05:10 +01:00
parent b89bd9ef9a
commit d248714439
2 changed files with 4 additions and 2 deletions

View File

@ -130,7 +130,7 @@ static void red_qxl_display_migrate(RedChannelClient *rcc)
g_object_get(channel, "channel-type", &type, "id", &id, NULL);
dispatcher = (Dispatcher *)g_object_get_data(G_OBJECT(channel), "dispatcher");
spice_printerr("channel type %u id %u", type, id);
payload.rcc = rcc;
payload.rcc = g_object_ref(rcc);
dispatcher_send_message(dispatcher,
RED_WORKER_MESSAGE_DISPLAY_MIGRATE,
&payload);
@ -187,7 +187,7 @@ static void red_qxl_cursor_migrate(RedChannelClient *rcc)
g_object_get(channel, "channel-type", &type, "id", &id, NULL);
dispatcher = (Dispatcher *)g_object_get_data(G_OBJECT(channel), "dispatcher");
spice_printerr("channel type %u id %u", type, id);
payload.rcc = rcc;
payload.rcc = g_object_ref(rcc);
dispatcher_send_message(dispatcher,
RED_WORKER_MESSAGE_CURSOR_MIGRATE,
&payload);

View File

@ -747,6 +747,7 @@ static void handle_dev_display_migrate(void *opaque, void *payload)
spice_debug("migrate display client");
spice_assert(rcc);
red_migrate_display(worker->display_channel, rcc);
g_object_unref(rcc);
}
static inline uint32_t qxl_monitors_config_size(uint32_t heads)
@ -828,6 +829,7 @@ static void handle_dev_cursor_migrate(void *opaque, void *payload)
spice_debug("migrate cursor client");
cursor_channel_client_migrate(rcc);
g_object_unref(rcc);
}
static void handle_dev_set_compression(void *opaque, void *payload)