X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;ds=sidebyside;f=src%2Fgis-plugin.c;h=eb162b7c861df7a6ff6eebff77d1914bdba1712f;hb=becee285e152746e64b6d3984e2a7229f664062d;hp=2ba5ca69a61aef70a6591412d9a1c07f3a336f0f;hpb=ac7156bd84aef88b712f117f7e2f3d847d371719;p=grits diff --git a/src/gis-plugin.c b/src/gis-plugin.c index 2ba5ca6..eb162b7 100644 --- a/src/gis-plugin.c +++ b/src/gis-plugin.c @@ -56,7 +56,8 @@ void gis_plugin_expose(GisPlugin *self) GtkWidget *gis_plugin_get_config(GisPlugin *self) { g_return_val_if_fail(GIS_IS_PLUGIN(self), NULL); - return GIS_PLUGIN_GET_INTERFACE(self)->get_config(self); + GisPluginInterface *iface = GIS_PLUGIN_GET_INTERFACE(self); + return iface->get_config ? iface->get_config (self) : NULL; } @@ -122,10 +123,13 @@ GisPlugin *gis_plugins_load(GisPlugins *self, const char *name, { g_debug("GisPlugins: load %s", name); gchar *path = g_strdup_printf("%s/%s.%s", self->dir, name, G_MODULE_SUFFIX); - if (!g_file_test(path, G_FILE_TEST_EXISTS)) + if (!g_file_test(path, G_FILE_TEST_EXISTS)) { + g_free(path); path = g_strdup_printf("%s/%s.%s", PLUGINSDIR, name, G_MODULE_SUFFIX); + } if (!g_file_test(path, G_FILE_TEST_EXISTS)) { g_warning("Module %s not found", name); + g_free(path); return NULL; } GModule *module = g_module_open(path, 0); @@ -147,7 +151,7 @@ GisPlugin *gis_plugins_load(GisPlugins *self, const char *name, g_free(constructor_str); GisPluginConstructor constructor = constructor_ptr; - GisPluginStore *store = g_malloc(sizeof(GisPluginStore)); + GisPluginStore *store = g_new0(GisPluginStore, 1); store->name = g_strdup(name); store->plugin = constructor(world, view, opengl, prefs); g_ptr_array_add(self->plugins, store);