Blame SOURCES/0167-image-device-Fix-reading-default-values-from-the-cla.patch

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