st/icon-theme: Replace slice allocator

Its use has been discouraged for years, and glib recently deprecated
it officially (while turning it around a small wrapper around malloc).

Don't let it sneak back in through some old GTK3 code.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2620>
This commit is contained in:
Florian Müllner 2023-01-25 18:36:08 +01:00 committed by Marge Bot
parent b10a0ec45b
commit c908e220db

View File

@ -500,7 +500,7 @@ free_dir_mtime (IconThemeDirMtime *dir_mtime)
_gtk_icon_cache_unref (dir_mtime->cache); _gtk_icon_cache_unref (dir_mtime->cache);
g_free (dir_mtime->dir); g_free (dir_mtime->dir);
g_slice_free (IconThemeDirMtime, dir_mtime); g_free (dir_mtime);
} }
static gboolean static gboolean
@ -810,7 +810,7 @@ insert_theme (GtkIconTheme *icon_theme,
path = g_build_filename (icon_theme->search_path[i], path = g_build_filename (icon_theme->search_path[i],
theme_name, theme_name,
NULL); NULL);
dir_mtime = g_slice_new (IconThemeDirMtime); dir_mtime = g_new (IconThemeDirMtime, 1);
dir_mtime->cache = NULL; dir_mtime->cache = NULL;
dir_mtime->dir = path; dir_mtime->dir = path;
if (g_stat (path, &stat_buf) == 0 && S_ISDIR (stat_buf.st_mode)) { if (g_stat (path, &stat_buf) == 0 && S_ISDIR (stat_buf.st_mode)) {
@ -925,7 +925,7 @@ free_unthemed_icon (UnthemedIcon *unthemed_icon)
{ {
g_free (unthemed_icon->svg_filename); g_free (unthemed_icon->svg_filename);
g_free (unthemed_icon->no_svg_filename); g_free (unthemed_icon->no_svg_filename);
g_slice_free (UnthemedIcon, unthemed_icon); g_free (unthemed_icon);
} }
static char * static char *
@ -995,7 +995,7 @@ add_unthemed_icon (GtkIconTheme *icon_theme,
} }
else else
{ {
unthemed_icon = g_slice_new0 (UnthemedIcon); unthemed_icon = g_new0 (UnthemedIcon, 1);
unthemed_icon->is_resource = is_resource; unthemed_icon->is_resource = is_resource;
@ -1041,7 +1041,7 @@ load_themes (GtkIconTheme *icon_theme)
{ {
dir = icon_theme->search_path[base]; dir = icon_theme->search_path[base];
dir_mtime = g_slice_new (IconThemeDirMtime); dir_mtime = g_new (IconThemeDirMtime, 1);
icon_theme->dir_mtimes = g_list_prepend (icon_theme->dir_mtimes, dir_mtime); icon_theme->dir_mtimes = g_list_prepend (icon_theme->dir_mtimes, dir_mtime);
dir_mtime->dir = g_strdup (dir); dir_mtime->dir = g_strdup (dir);
@ -4188,7 +4188,7 @@ async_symbolic_data_free (AsyncSymbolicData *data)
{ {
if (data->dup) if (data->dup)
g_object_unref (data->dup); g_object_unref (data->dup);
g_slice_free (AsyncSymbolicData, data); g_free (data);
} }
static void static void
@ -4277,7 +4277,7 @@ gtk_icon_info_load_symbolic_async (GtkIconInfo *icon_info,
task = g_task_new (icon_info, cancellable, callback, user_data); task = g_task_new (icon_info, cancellable, callback, user_data);
data = g_slice_new0 (AsyncSymbolicData); data = g_new0 (AsyncSymbolicData, 1);
g_task_set_task_data (task, data, (GDestroyNotify) async_symbolic_data_free); g_task_set_task_data (task, data, (GDestroyNotify) async_symbolic_data_free);
data->is_symbolic = gtk_icon_info_is_symbolic (icon_info); data->is_symbolic = gtk_icon_info_is_symbolic (icon_info);