From 0dec274e56c23c4afdda75bb42d5b6c9928cb1b6 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Mon, 18 Sep 2017 11:07:39 +0100 Subject: [PATCH] Fix a crash when using fu_plugin_device_add_delay() By removing the device from the hash table before we add it to the devices array we could inadvertently drop the last object reference if the plugin is not using the (optional) cache. Just re-arrange things to fix https://github.com/hughsie/fwupd/issues/259 --- src/fu-plugin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fu-plugin.c b/src/fu-plugin.c index ffa1c0847..61cc53da5 100644 --- a/src/fu-plugin.c +++ b/src/fu-plugin.c @@ -372,8 +372,8 @@ static gboolean fu_plugin_device_add_delay_cb (gpointer user_data) { FuPluginHelper *helper = (FuPluginHelper *) user_data; - g_hash_table_remove (helper->devices, helper->device); fu_plugin_device_add (helper->plugin, helper->device); + g_hash_table_remove (helper->devices, helper->device); fu_plugin_helper_free (helper); return FALSE; }