Blame SOURCES/0006-Fix-a-crash-when-using-fwupdtool.patch

003958
From 9b48540a255bc91679de93a388600a61d9ca02c6 Mon Sep 17 00:00:00 2001
003958
From: Richard Hughes <richard@hughsie.com>
003958
Date: Wed, 27 Jan 2021 10:45:21 +0000
003958
Subject: [PATCH 06/11] Fix a crash when using fwupdtool
003958
003958
The docs for `fwupd_device_get_children()` make it very clear that only the
003958
parent should be assigned. Also add a warning to `fwupd_device_add_child()`
003958
explaining it is for internal daemon use only.
003958
---
003958
 libfwupd/fwupd-device.c | 7 ++++---
003958
 1 file changed, 4 insertions(+), 3 deletions(-)
003958
003958
diff --git libfwupd/fwupd-device.c libfwupd/fwupd-device.c
003958
index 7e3ceca9..2f3f4ddb 100644
003958
--- libfwupd/fwupd-device.c
003958
+++ libfwupd/fwupd-device.c
003958
@@ -370,6 +370,9 @@ fwupd_device_set_parent (FwupdDevice *device, FwupdDevice *parent)
003958
  * Adds a child device. An child device is logically linked to the primary
003958
  * device in some way.
003958
  *
003958
+ * NOTE: You should never call this function from user code, it is for daemon
003958
+ * use only. Only use fwupd_device_set_parent() to set up a logical tree.
003958
+ *
003958
  * Since: 1.5.1
003958
  **/
003958
 void
003958
@@ -2646,10 +2649,8 @@ fwupd_device_array_ensure_parents (GPtrArray *devices)
003958
 		if (parent_id != NULL) {
003958
 			FwupdDevice *dev_tmp;
003958
 			dev_tmp = g_hash_table_lookup (devices_by_id, parent_id);
003958
-			if (dev_tmp != NULL) {
003958
-				fwupd_device_add_child (dev_tmp, dev);
003958
+			if (dev_tmp != NULL)
003958
 				fwupd_device_set_parent (dev, dev_tmp);
003958
-			}
003958
 		}
003958
 	}
003958
 }
003958
-- 
003958
2.29.2
003958