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