libfprint/SOURCES/0167-image-device-Fix-reading-default-values-from-the-cla.patch
2021-09-09 20:12:48 +00:00

70 lines
2.3 KiB
Diff

From e4f3385a7745f9467cbbe80ca8a2d411dbb1bd77 Mon Sep 17 00:00:00 2001
From: Benjamin Berg <bberg@redhat.com>
Date: Thu, 2 Jan 2020 18:46:00 +0100
Subject: [PATCH 167/181] image-device: Fix reading default values from the
class
We cannot copy information from the class in the _init routine, instead,
this needs to be done in _constructed. Move the relevant code into a new
_constructed function to fix importing the bz3_threshold override from
drivers.
Fixes: #206
---
libfprint/fp-image-device.c | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/libfprint/fp-image-device.c b/libfprint/fp-image-device.c
index 20e181e..c4de7bb 100644
--- a/libfprint/fp-image-device.c
+++ b/libfprint/fp-image-device.c
@@ -245,6 +245,23 @@ fp_image_device_get_property (GObject *object,
}
}
+static void
+fp_image_device_constructed (GObject *obj)
+{
+ FpImageDevice *self = FP_IMAGE_DEVICE (obj);
+ FpImageDevicePrivate *priv = fp_image_device_get_instance_private (self);
+ FpImageDeviceClass *cls = FP_IMAGE_DEVICE_GET_CLASS (self);
+
+ /* Set default values. */
+ fpi_device_set_nr_enroll_stages (FP_DEVICE (self), IMG_ENROLL_STAGES);
+
+ priv->bz3_threshold = BOZORTH3_DEFAULT_THRESHOLD;
+ if (cls->bz3_threshold > 0)
+ priv->bz3_threshold = cls->bz3_threshold;
+
+ G_OBJECT_CLASS (fp_image_device_parent_class)->constructed (obj);
+}
+
static void
fp_image_device_class_init (FpImageDeviceClass *klass)
{
@@ -253,6 +270,7 @@ fp_image_device_class_init (FpImageDeviceClass *klass)
object_class->finalize = fp_image_device_finalize;
object_class->get_property = fp_image_device_get_property;
+ object_class->constructed = fp_image_device_constructed;
fp_device_class->open = fp_image_device_open;
fp_device_class->close = fp_image_device_close;
@@ -305,13 +323,4 @@ fp_image_device_class_init (FpImageDeviceClass *klass)
static void
fp_image_device_init (FpImageDevice *self)
{
- FpImageDevicePrivate *priv = fp_image_device_get_instance_private (self);
- FpImageDeviceClass *cls = FP_IMAGE_DEVICE_GET_CLASS (self);
-
- /* Set default values. */
- fpi_device_set_nr_enroll_stages (FP_DEVICE (self), IMG_ENROLL_STAGES);
-
- priv->bz3_threshold = BOZORTH3_DEFAULT_THRESHOLD;
- if (cls->bz3_threshold > 0)
- priv->bz3_threshold = cls->bz3_threshold;
}
--
2.24.1