mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-08 03:47:18 +00:00
Use weak gobject ref instead of reds_on_char_device_state_destroy
RedCharDevice implementation had to callback into reds.c in order to let it know a char device was being destroyed. Now that RedCharDevice is a gobject, a weak reference can be used instead allowing to remove that coupling. Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
parent
d232e92794
commit
64dc3ab244
@ -1111,8 +1111,6 @@ red_char_device_finalize(GObject *object)
|
||||
{
|
||||
RedCharDevice *self = RED_CHAR_DEVICE(object);
|
||||
|
||||
/* FIXME: replace with g_object_weak_ref () */
|
||||
reds_on_char_device_state_destroy(self->priv->reds, self);
|
||||
if (self->priv->write_to_dev_timer) {
|
||||
reds_core_timer_remove(self->priv->reds, self->priv->write_to_dev_timer);
|
||||
self->priv->write_to_dev_timer = NULL;
|
||||
|
||||
@ -252,7 +252,6 @@ static void reds_mig_target_client_free(RedsMigTargetClient *mig_client);
|
||||
static void reds_mig_cleanup_wait_disconnect(RedsState *reds);
|
||||
static void reds_mig_remove_wait_disconnect_client(RedsState *reds, RedClient *client);
|
||||
static void reds_add_char_device(RedsState *reds, RedCharDevice *dev);
|
||||
static void reds_remove_char_device(RedsState *reds, RedCharDevice *dev);
|
||||
static void reds_send_mm_time(RedsState *reds);
|
||||
static void reds_on_ic_change(RedsState *reds);
|
||||
static void reds_on_sv_change(RedsState *reds);
|
||||
@ -3142,15 +3141,13 @@ static void reds_add_char_device(RedsState *reds, RedCharDevice *dev)
|
||||
reds->char_devices = g_list_append(reds->char_devices, dev);
|
||||
}
|
||||
|
||||
static void reds_remove_char_device(RedsState *reds, RedCharDevice *dev)
|
||||
static void reds_on_char_device_destroy(RedsState *reds,
|
||||
RedCharDevice *dev)
|
||||
{
|
||||
g_return_if_fail(reds != NULL);
|
||||
g_warn_if_fail(g_list_find(reds->char_devices, dev) != NULL);
|
||||
reds->char_devices = g_list_remove(reds->char_devices, dev);
|
||||
}
|
||||
|
||||
void reds_on_char_device_state_destroy(RedsState *reds, RedCharDevice *dev)
|
||||
{
|
||||
reds_remove_char_device(reds, dev);
|
||||
reds->char_devices = g_list_remove(reds->char_devices, dev);
|
||||
}
|
||||
|
||||
static int spice_server_char_device_add_interface(SpiceServer *reds,
|
||||
@ -3188,6 +3185,10 @@ static int spice_server_char_device_add_interface(SpiceServer *reds,
|
||||
|
||||
if (dev_state) {
|
||||
spice_assert(char_device->st);
|
||||
|
||||
g_object_weak_ref(G_OBJECT(dev_state),
|
||||
(GWeakNotify)reds_on_char_device_destroy,
|
||||
reds);
|
||||
/* setting the char_device state to "started" for backward compatibily with
|
||||
* qemu releases that don't call spice api for start/stop (not implemented yet) */
|
||||
if (reds->vm_running) {
|
||||
|
||||
@ -100,7 +100,6 @@ int reds_on_migrate_dst_set_seamless(RedsState *reds, MainChannelClient *mcc, ui
|
||||
void reds_on_client_semi_seamless_migrate_complete(RedsState *reds, RedClient *client);
|
||||
void reds_on_client_seamless_migrate_complete(RedsState *reds, RedClient *client);
|
||||
void reds_on_main_channel_migrate(RedsState *reds, MainChannelClient *mcc);
|
||||
void reds_on_char_device_state_destroy(RedsState *reds, RedCharDevice *dev);
|
||||
|
||||
void reds_set_client_mm_time_latency(RedsState *reds, RedClient *client, uint32_t latency);
|
||||
uint32_t reds_get_streaming_video(const RedsState *reds);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user