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

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