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

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