diff options
author | monsta <[email protected]> | 2015-12-02 13:33:13 +0300 |
---|---|---|
committer | monsta <[email protected]> | 2015-12-07 11:12:01 +0300 |
commit | 78f18ad5335b5b8fca7d1039f0fd14037b716baa (patch) | |
tree | 9bc76b2676191c958ea5c87590f2d1499bb96852 | |
parent | 0b334ce4e863b227054237beb3d4064e7893f3b6 (diff) | |
download | mate-terminal-78f18ad5335b5b8fca7d1039f0fd14037b716baa.tar.bz2 mate-terminal-78f18ad5335b5b8fca7d1039f0fd14037b716baa.tar.xz |
simplify some more code and don't leak memory
-rw-r--r-- | src/terminal-app.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/terminal-app.c b/src/terminal-app.c index 3411296..ab067d3 100644 --- a/src/terminal-app.c +++ b/src/terminal-app.c @@ -736,7 +736,8 @@ terminal_app_profile_list_notify_cb (GSettings *settings, TerminalApp *app = TERMINAL_APP (user_data); GObject *object = G_OBJECT (app); GVariant *val; - GSList *value_list, *sl; + const gchar **value_list; + int i; GList *profiles_to_delete, *l; gboolean need_new_default; TerminalProfile *fallback; @@ -752,12 +753,14 @@ terminal_app_profile_list_notify_cb (GSettings *settings, !g_variant_is_of_type (val, G_VARIANT_TYPE_STRING))) goto ensure_one_profile; - value_list = mate_gsettings_strv_to_gslist( g_variant_get_strv (val, NULL)); + value_list = g_variant_get_strv (val, NULL); + if (value_list == NULL) + goto ensure_one_profile; /* Add any new ones */ - for (sl = value_list; sl != NULL; sl = sl->next) + for (i = 0; value_list[i] != NULL; ++i) { - const char *profile_name = sl->data; + const char *profile_name = value_list[i]; GList *link; if (!profile_name) @@ -771,8 +774,13 @@ terminal_app_profile_list_notify_cb (GSettings *settings, terminal_app_create_profile (app, profile_name); } + g_free (value_list); + ensure_one_profile: + if (val != NULL) + g_variant_unref (val); + fallback = NULL; count = g_hash_table_size (app->profiles); if (count == 0 || count <= g_list_length (profiles_to_delete)) |