diff options
author | Florian Müllner <fmuellner@gnome.org> | 2012-02-20 08:33:49 +0100 |
---|---|---|
committer | Florian Müllner <fmuellner@gnome.org> | 2012-02-20 11:41:57 +0100 |
commit | b990ed2c232e85b37630fdf0b8daad5727212013 (patch) | |
tree | 189a950c95f1ad38a778b0e642a85aeef9c21ab2 /src/shell-app-system.c | |
parent | 097e56f4ab2e73db812ac63ed61d9527d83a8d54 (diff) |
app-system: Don't assume that gmenu_tree_load_sync() sets error
The function may return FALSE without setting the GError, so don't
assume it is set to prevent a crash in that case. While at it, free
the GError we were leaking before.
https://bugzilla.gnome.org/show_bug.cgi?id=670418
Diffstat (limited to 'src/shell-app-system.c')
-rw-r--r-- | src/shell-app-system.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/shell-app-system.c b/src/shell-app-system.c index f6c8c011..a80b2339 100644 --- a/src/shell-app-system.c +++ b/src/shell-app-system.c @@ -320,7 +320,15 @@ on_apps_tree_changed_cb (GMenuTree *tree, if (!gmenu_tree_load_sync (self->priv->apps_tree, &error)) { - g_warning ("Failed to load apps: %s", error->message); + if (error) + { + g_warning ("Failed to load apps: %s", error->message); + g_error_free (error); + } + else + { + g_warning ("Failed to load apps"); + } return; } @@ -411,7 +419,15 @@ on_settings_tree_changed_cb (GMenuTree *tree, g_hash_table_remove_all (self->priv->setting_id_to_app); if (!gmenu_tree_load_sync (self->priv->settings_tree, &error)) { - g_warning ("Failed to load settings: %s", error->message); + if (error) + { + g_warning ("Failed to load apps: %s", error->message); + g_error_free (error); + } + else + { + g_warning ("Failed to load apps"); + } return; } |