gplugin/gplugin

Fix a few of our failing ci issues

2020-09-22, Gary Kramlich
0f07cacab39d
Parents 2116940747cd
Children b584814d5f13
Fix a few of our failing ci issues

g_queue_clear_full was added in 2.60 but we only require 2.40

clang-format some files that were missing it.

Clean up the paths variable from command line parsing

Fix some leaks that the signal test caused and found

Testing Done:
Ran the valgrind convey plan. It still fails, mostly related to https://issues.imfreedom.org/issue/GPLUGIN-117.

Reviewed at https://reviews.imfreedom.org/r/130/
--- a/gplugin-gtk/gplugin-gtk-plugin-info.c Mon Sep 21 22:04:08 2020 -0500
+++ b/gplugin-gtk/gplugin-gtk-plugin-info.c Tue Sep 22 00:30:00 2020 -0500
@@ -120,7 +120,8 @@
g_list_free(children);
/* remove all the children from the dependencies box */
- children = gtk_container_get_children(GTK_CONTAINER(info->dependencies_box));
+ children =
+ gtk_container_get_children(GTK_CONTAINER(info->dependencies_box));
for(iter = children; iter; iter = iter->next)
gtk_widget_destroy(GTK_WIDGET(iter->data));
g_list_free(children);
--- a/gplugin/gplugin-manager.c Mon Sep 21 22:04:08 2020 -0500
+++ b/gplugin/gplugin-manager.c Tue Sep 22 00:30:00 2020 -0500
@@ -356,7 +356,9 @@
static void
gplugin_manager_real_remove_paths(GPluginManager *manager)
{
- g_queue_clear_full(manager->paths, g_free);
+ /* g_queue_clear_full was added in 2.60 but we require 2.40 */
+ g_queue_foreach(manager->paths, (GFunc)g_free, NULL);
+ g_queue_clear(manager->paths);
}
static GList *
--- a/gplugin/gplugin-native-plugin.c Mon Sep 21 22:04:08 2020 -0500
+++ b/gplugin/gplugin-native-plugin.c Tue Sep 22 00:30:00 2020 -0500
@@ -187,6 +187,7 @@
plugin->state = g_value_get_enum(value);
break;
case PROP_ERROR:
+ g_clear_error(&plugin->error);
plugin->error = g_value_dup_boxed(value);
break;
--- a/gplugin/gplugin-options.c Mon Sep 21 22:04:08 2020 -0500
+++ b/gplugin/gplugin-options.c Tue Sep 22 00:30:00 2020 -0500
@@ -92,7 +92,6 @@
G_GNUC_UNUSED GError **error)
{
GPluginCoreFlags flags = GPLUGIN_CORE_FLAGS_NONE;
- gint i = 0;
if(!register_native_loader) {
flags |= GPLUGIN_CORE_FLAGS_DISABLE_NATIVE_LOADER;
@@ -100,12 +99,19 @@
gplugin_init(flags);
- if(add_default_paths)
+ if(add_default_paths) {
gplugin_manager_add_default_paths();
+ }
+
+ if(paths != NULL) {
+ guint i = 0;
- if(paths)
- for(i = 0; paths[i]; paths++)
+ for(i = 0; paths[i] != NULL; i++) {
gplugin_manager_prepend_path(paths[i]);
+ }
+
+ g_clear_pointer(&paths, g_strfreev);
+ }
return TRUE;
}
--- a/gplugin/tests/test-signals.c Mon Sep 21 22:04:08 2020 -0500
+++ b/gplugin/tests/test-signals.c Tue Sep 22 00:30:00 2020 -0500
@@ -234,6 +234,8 @@
plugin = gplugin_manager_find_plugin("gplugin/native-basic-plugin");
gplugin_manager_load_plugin(plugin, &error);
g_assert_error(error, GPLUGIN_DOMAIN, 0);
+ g_error_free(error);
+
g_assert_true(data.loading);
g_assert_false(data.loaded);
g_assert_false(data.unloading);
@@ -291,6 +293,8 @@
gplugin_manager_unload_plugin(plugin, &error);
g_assert_error(error, GPLUGIN_DOMAIN, 0);
+ g_error_free(error);
+
g_assert_true(data.unloading);
g_assert_false(data.unloaded);
@@ -329,6 +333,8 @@
plugin = gplugin_manager_find_plugin("gplugin/native-load-failed");
gplugin_manager_load_plugin(plugin, &error);
g_assert_error(error, GPLUGIN_DOMAIN, 0);
+ g_error_free(error);
+
g_assert_true(data.loading);
g_assert_true(data.load_failed);
@@ -382,6 +388,8 @@
gplugin_manager_unload_plugin(plugin, &error);
g_assert_error(error, GPLUGIN_DOMAIN, 0);
+ g_error_free(error);
+
g_assert_true(data.unloading);
g_assert_true(data.unload_failed);
--- a/python3/gplugin-python3-test-pygobject.c Mon Sep 21 22:04:08 2020 -0500
+++ b/python3/gplugin-python3-test-pygobject.c Tue Sep 22 00:30:00 2020 -0500
@@ -35,7 +35,9 @@
/* setup wargv */
len = mbstowcs(NULL, argv[0], 0);
if(len == (size_t)-1) {
- printf("Failed to call mbstowcs to find length of argv[0]: %s\n", argv[0]);
+ printf(
+ "Failed to call mbstowcs to find length of argv[0]: %s\n",
+ argv[0]);
return -1;
}