Merge branch 'fix-memleaks' into 'master'

Fix memleaks

See merge request GNOME/gtk!3360
This commit is contained in:
Matthias Clasen 2021-03-28 14:23:35 +00:00
commit 3e1a8aa286
6 changed files with 49 additions and 24 deletions

View File

@ -285,3 +285,11 @@
...
fun:g_intern_static_string
}
# Threads
{
pthread
Memcheck:Leak
fun:calloc
fun:_dl_allocate_tls
}

View File

@ -1052,6 +1052,8 @@ gtk_css_provider_load_internal (GtkCssProvider *self,
"Failed to import: %s",
load_error->message);
}
g_error_free (load_error);
}
}

View File

@ -7,3 +7,4 @@ leak:libglib-2.0.so
leak:libgio-2.0.so
leak:libcairo.so
leak:libpixman-1.so
leak:librsvg-2.so

View File

@ -1,31 +1,42 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
static void
test_format (gconstpointer d)
{
const char *f = d;
GSList *formats;
gboolean found;
found = FALSE;
formats = gdk_pixbuf_get_formats ();
for (GSList *l = formats; l && !found; l = l->next)
{
GdkPixbufFormat *format = l->data;
char *name;
name = gdk_pixbuf_format_get_name (format);
if (strcmp (name, f) == 0)
found = TRUE;
g_free (name);
}
g_slist_free (formats);
g_assert_true (found);
}
int
main (int argc, char *argv[])
{
GSList *formats;
gboolean have_png, have_jpeg;
g_test_init (&argc, &argv, NULL);
have_png = FALSE;
have_jpeg = FALSE;
g_test_add_data_func ("/pixbuf/format/png", "png", test_format);
g_test_add_data_func ("/pixbuf/format/jpeg", "jpeg", test_format);
formats = gdk_pixbuf_get_formats ();
for (GSList *l = formats; l; l = l->next)
{
GdkPixbufFormat *format = l->data;
const char *name;
name = gdk_pixbuf_format_get_name (format);
if (strcmp (name, "png") == 0)
have_png = TRUE;
else if (strcmp (name, "jpeg") == 0)
have_jpeg = TRUE;
}
if (!have_png || !have_jpeg)
return 1;
return 0;
return g_test_run ();
}

View File

@ -553,6 +553,9 @@ test_splice_overflow (void)
compare = gtk_bitset_new_range (16, 1);
g_assert_true (gtk_bitset_equals (set, compare));
gtk_bitset_unref (compare);
gtk_bitset_unref (set);
}
int

View File

@ -167,7 +167,7 @@ test_create_builder (void)
list = GTK_STRING_LIST (gtk_builder_get_object (builder, "list"));
assert_model (list, "a b c");
g_object_unref (list);
g_object_unref (builder);
}
static void