mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-23 22:16:16 +01:00
tests: Various minor leak fixes in the GIO tests
Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
parent
68526565f4
commit
93b519b104
@ -381,6 +381,7 @@ test_associations (void)
|
||||
"cmdline-app-test",
|
||||
G_APP_INFO_CREATE_SUPPORTS_URIS,
|
||||
NULL);
|
||||
g_free (cmdline);
|
||||
|
||||
error = NULL;
|
||||
result = g_app_info_set_as_default_for_type (appinfo, "application/x-glib-test", &error);
|
||||
|
@ -254,11 +254,14 @@ test_dbus_appinfo (void)
|
||||
const gchar *argv[] = { "myapp", NULL };
|
||||
TestApplication *app;
|
||||
int status;
|
||||
gchar *desktop_file = NULL;
|
||||
|
||||
appinfo = g_desktop_app_info_new_from_filename (g_test_build_filename (G_TEST_DIST,
|
||||
"org.gtk.test.dbusappinfo.desktop",
|
||||
NULL));
|
||||
desktop_file = g_test_build_filename (G_TEST_DIST,
|
||||
"org.gtk.test.dbusappinfo.desktop",
|
||||
NULL);
|
||||
appinfo = g_desktop_app_info_new_from_filename (desktop_file);
|
||||
g_assert (appinfo != NULL);
|
||||
g_free (desktop_file);
|
||||
|
||||
app = g_object_new (test_application_get_type (),
|
||||
"application-id", "org.gtk.test.dbusappinfo",
|
||||
|
@ -93,6 +93,8 @@ test_delete (void)
|
||||
res = g_app_info_delete (info);
|
||||
g_assert (!res);
|
||||
}
|
||||
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -115,6 +117,7 @@ test_default (void)
|
||||
info = g_app_info_get_default_for_type ("application/x-test", FALSE);
|
||||
g_assert (info != NULL);
|
||||
g_assert_cmpstr (g_app_info_get_id (info), ==, g_app_info_get_id (info2));
|
||||
g_object_unref (info);
|
||||
|
||||
/* now try adding something, but not setting as default */
|
||||
g_app_info_add_supports_type (info3, "application/x-test", &error);
|
||||
@ -124,6 +127,7 @@ test_default (void)
|
||||
info = g_app_info_get_default_for_type ("application/x-test", FALSE);
|
||||
g_assert (info != NULL);
|
||||
g_assert_cmpstr (g_app_info_get_id (info), ==, g_app_info_get_id (info2));
|
||||
g_object_unref (info);
|
||||
|
||||
/* now remove info1 again */
|
||||
g_app_info_remove_supports_type (info1, "application/x-test", &error);
|
||||
@ -133,6 +137,7 @@ test_default (void)
|
||||
info = g_app_info_get_default_for_type ("application/x-test", FALSE);
|
||||
g_assert (info != NULL);
|
||||
g_assert_cmpstr (g_app_info_get_id (info), ==, g_app_info_get_id (info2));
|
||||
g_object_unref (info);
|
||||
|
||||
/* now clean it all up */
|
||||
g_app_info_reset_type_associations ("application/x-test");
|
||||
@ -146,6 +151,7 @@ test_default (void)
|
||||
|
||||
g_object_unref (info1);
|
||||
g_object_unref (info2);
|
||||
g_object_unref (info3);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -324,6 +330,8 @@ cleanup_dir_recurse (GFile *parent,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_clear_object (&enumerator);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -342,6 +350,7 @@ cleanup_subdirs (const char *base_dir)
|
||||
(void) cleanup_dir_recurse (file, file, &error);
|
||||
g_assert_no_error (error);
|
||||
g_object_unref (file);
|
||||
g_object_unref (base);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -45,6 +45,8 @@ test_filesystem_readonly (gconstpointer with_mount_monitor)
|
||||
{
|
||||
/* We need these because "mount --bind" requires root privileges */
|
||||
g_test_skip ("'bindfs' and 'fusermount' commands are needed to run this test");
|
||||
g_free (fusermount);
|
||||
g_free (bindfs);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -258,6 +258,8 @@ setup (Test *test,
|
||||
|
||||
g_assert (test->server);
|
||||
g_assert (test->client);
|
||||
|
||||
g_object_unref (stream);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -875,6 +875,7 @@ test_peer (void)
|
||||
getuid ());
|
||||
g_assert_cmpuint (g_credentials_get_unix_pid (credentials, NULL), ==,
|
||||
getpid ());
|
||||
g_object_unref (credentials);
|
||||
#else
|
||||
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED);
|
||||
g_assert (credentials == NULL);
|
||||
@ -1358,6 +1359,8 @@ test_nonce_tcp (void)
|
||||
|
||||
g_main_loop_quit (service_loop);
|
||||
g_thread_join (service_thread);
|
||||
|
||||
g_ptr_array_unref (data.current_connections);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1711,6 +1714,7 @@ codegen_test_peer (void)
|
||||
* change notifications anyway because those are done from an idle handler
|
||||
*/
|
||||
example_animal_call_poke_sync (animal2, TRUE, TRUE, NULL, &error);
|
||||
g_clear_error (&error);
|
||||
|
||||
g_object_unref (animal1);
|
||||
g_object_unref (animal2);
|
||||
|
@ -547,7 +547,8 @@ test_uri_query_info (void)
|
||||
GBytes *data;
|
||||
GFile *file;
|
||||
GFileInfo *info;
|
||||
const char *content_type, *mime_type;
|
||||
const char *content_type;
|
||||
gchar *mime_type = NULL;
|
||||
const char *fs_type;
|
||||
gboolean readonly;
|
||||
|
||||
@ -573,6 +574,7 @@ test_uri_query_info (void)
|
||||
mime_type = g_content_type_get_mime_type (content_type);
|
||||
g_assert (mime_type);
|
||||
g_assert_cmpstr (mime_type, ==, "text/plain");
|
||||
g_free (mime_type);
|
||||
|
||||
g_object_unref (info);
|
||||
|
||||
|
@ -77,6 +77,7 @@ test_uris (void)
|
||||
g_assert_cmpstr (error->message, ==, str);
|
||||
g_clear_error (&error);
|
||||
g_assert_null (proxies);
|
||||
g_object_unref (result);
|
||||
|
||||
g_object_unref (resolver);
|
||||
g_free (str);
|
||||
|
@ -1902,6 +1902,7 @@ legacy_error_callback (GObject *object,
|
||||
|
||||
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_FAILED);
|
||||
*result_out = -2;
|
||||
g_clear_error (&error);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -178,6 +178,7 @@ main_thread_read (GObject *source, GAsyncResult *res, gpointer user_data)
|
||||
if (g_cancellable_is_cancelled (main_cancel))
|
||||
{
|
||||
do_main_cancel (out);
|
||||
g_clear_error (&err);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -214,6 +215,7 @@ main_thread_wrote (GObject *source, GAsyncResult *res, gpointer user_data)
|
||||
if (g_cancellable_is_cancelled (main_cancel))
|
||||
{
|
||||
do_main_cancel (out);
|
||||
g_clear_error (&err);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user