virtual-device: Properly cleanup the virtual devices data
Ensure we call the parent finalize function and cleanup local data
This commit is contained in:
parent
e8886dbc6b
commit
a291d17f26
2 changed files with 17 additions and 0 deletions
|
@ -167,6 +167,16 @@ fpi_device_virtual_device_storage_init (FpDeviceVirtualDeviceStorage *self)
|
|||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
fpi_device_virtual_device_storage_finalize (GObject *object)
|
||||
{
|
||||
FpDeviceVirtualDevice *vdev = FP_DEVICE_VIRTUAL_DEVICE (object);
|
||||
|
||||
G_DEBUG_HERE ();
|
||||
g_clear_pointer (&vdev->prints_storage, g_hash_table_destroy);
|
||||
G_OBJECT_CLASS (fpi_device_virtual_device_storage_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static const FpIdEntry driver_ids[] = {
|
||||
{ .virtual_envvar = "FP_VIRTUAL_DEVICE_STORAGE" },
|
||||
{ .virtual_envvar = "FP_VIRTUAL_DEVICE_IDENT" },
|
||||
|
@ -177,6 +187,9 @@ static void
|
|||
fpi_device_virtual_device_storage_class_init (FpDeviceVirtualDeviceStorageClass *klass)
|
||||
{
|
||||
FpDeviceClass *dev_class = FP_DEVICE_CLASS (klass);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = fpi_device_virtual_device_storage_finalize;
|
||||
|
||||
dev_class->id = FP_COMPONENT;
|
||||
dev_class->full_name = "Virtual device with storage and identification for debugging";
|
||||
|
|
|
@ -419,7 +419,11 @@ dev_deinit (FpDevice *dev)
|
|||
static void
|
||||
fpi_device_virtual_device_finalize (GObject *object)
|
||||
{
|
||||
FpDeviceVirtualDevice *self = FP_DEVICE_VIRTUAL_DEVICE (object);
|
||||
|
||||
G_DEBUG_HERE ();
|
||||
g_clear_pointer (&self->pending_commands, g_ptr_array_unref);
|
||||
G_OBJECT_CLASS (fpi_device_virtual_device_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue