[gnome-software] plugin loader: Fix a null pointer dereference when shutting down
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] plugin loader: Fix a null pointer dereference when shutting down
- Date: Thu, 25 Jun 2015 12:17:53 +0000 (UTC)
commit bd382f6a1cbefde89234119d7e0a096febaffaea
Author: Kalev Lember <klember redhat com>
Date: Thu Jun 25 14:13:39 2015 +0200
plugin loader: Fix a null pointer dereference when shutting down
Make sure to call plugin destroy functions before clearing out the
plugin array. This fixes a fallout from the finalize->dispose changes.
src/gs-plugin-loader.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index af52f67..35f8835 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -3075,6 +3075,10 @@ gs_plugin_loader_dispose (GObject *object)
{
GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (object);
+ if (plugin_loader->priv->plugins != NULL) {
+ gs_plugin_loader_run (plugin_loader, "gs_plugin_destroy");
+ g_clear_pointer (&plugin_loader->priv->plugins, g_ptr_array_unref);
+ }
if (plugin_loader->priv->updates_changed_id != 0) {
g_source_remove (plugin_loader->priv->updates_changed_id);
plugin_loader->priv->updates_changed_id = 0;
@@ -3087,7 +3091,6 @@ gs_plugin_loader_dispose (GObject *object)
g_clear_object (&plugin_loader->priv->settings);
g_clear_pointer (&plugin_loader->priv->app_cache, g_hash_table_unref);
g_clear_pointer (&plugin_loader->priv->pending_apps, g_ptr_array_unref);
- g_clear_pointer (&plugin_loader->priv->plugins, g_ptr_array_unref);
G_OBJECT_CLASS (gs_plugin_loader_parent_class)->dispose (object);
}
@@ -3108,9 +3111,6 @@ gs_plugin_loader_finalize (GObject *object)
g_return_if_fail (plugin_loader->priv != NULL);
- /* run the plugins */
- gs_plugin_loader_run (plugin_loader, "gs_plugin_destroy");
-
g_strfreev (plugin_loader->priv->compatible_projects);
g_free (plugin_loader->priv->location);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]