gplugin/gplugin

Avoid a g_warning about calling g_object_unref on NULL
feature/gplugin-gtk-view-cleanups
2019-11-07, Gary Kramlich
a5e251b58087
Parents 321a2d04a07b
Children 193af070e88d
Avoid a g_warning about calling g_object_unref on NULL
--- a/gplugin-gtk/gplugin-gtk-plugin-info.c Thu Nov 07 21:26:34 2019 -0600
+++ b/gplugin-gtk/gplugin-gtk-plugin-info.c Thu Nov 07 21:33:40 2019 -0600
@@ -324,7 +324,13 @@
} else {
info->plugin = NULL;
}
- g_object_unref(G_OBJECT(orig_plugin));
+
+ /* now free the original plugin. This is done after the swap in the event
+ * that someone called us again with the same plugin.
+ */
+ if(GPLUGIN_IS_PLUGIN(orig_plugin)) {
+ g_object_unref(G_OBJECT(orig_plugin));
+ }
_gplugin_gtk_plugin_info_refresh(info, plugin);
}