Fix a crash when shutting down the daemon

Unloading the GModule means that any GTypes registered by that plugin cannot be
queried.

Other plugins could unintentionally call methods like G_OBJECT_TYPE_NAME()
which makes the daemon explode. There's no need to actually close the module,
and so we're just making life diffult for ourselves for no good reason.

Fixes the other half of https://github.com/fwupd/fwupd/issues/3156
This commit is contained in:
Richard Hughes 2021-04-20 14:28:44 +01:00
parent 08aeda737a
commit 248ea1b8a9

View File

@ -13,9 +13,6 @@
#include <errno.h>
#include <string.h>
#include <unistd.h>
#ifdef HAVE_VALGRIND
#include <valgrind.h>
#endif /* HAVE_VALGRIND */
#include "fu-context-private.h"
#include "fu-device-private.h"
@ -2328,14 +2325,6 @@ fu_plugin_finalize (GObject *object)
g_array_unref (priv->device_gtypes);
g_free (priv->build_hash);
g_free (priv->data);
/* Must happen as the last step to avoid prematurely
* freeing memory held by the plugin */
#ifdef RUNNING_ON_VALGRIND
if (priv->module != NULL && RUNNING_ON_VALGRIND == 0)
#else
if (priv->module != NULL)
#endif
g_module_close (priv->module);
G_OBJECT_CLASS (fu_plugin_parent_class)->finalize (object);
}