From f18371240cf3d32940e9a67844505b46006e0788 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 12 Sep 2015 03:41:34 +0000 Subject: Gracefully handle failure to open wrapper. git-svn-id: http://svn.drobilla.net/lad/trunk/suil@5724 a436a847-0d15-0410-975c-d299462d15a1 --- NEWS | 5 +++-- src/instance.c | 15 +++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index 8cfcb40..19faa92 100644 --- a/NEWS +++ b/NEWS @@ -4,10 +4,11 @@ suil (0.8.3) unstable; * Add Cocoa in Gtk wrapper (patch from Robin Gareus) * Various Windows fixes (patches from Robin Gareus) * Fix compilation with -Wl,--no-undefined - * Fix a few minor/unlikely memory errors. + * Fix a few minor/unlikely memory errors + * Gracefully handle failure to open wrapper * Only report suil_ui_supported() if necessary wrapper is compiled in - -- David Robillard Thu, 14 May 2015 01:26:31 -0400 + -- David Robillard Fri, 11 Sep 2015 17:38:26 -0400 suil (0.8.2) stable; diff --git a/src/instance.c b/src/instance.c index 4ace18c..a336dcb 100644 --- a/src/instance.c +++ b/src/instance.c @@ -65,10 +65,6 @@ open_wrapper(SuilHost* host, LV2_Feature*** features, unsigned n_features) { - if (!container_type_uri || !strcmp(container_type_uri, ui_type_uri)) { - return NULL; - } - const char* module_name = NULL; #ifdef SUIL_WITH_GTK2_IN_QT4 if (!strcmp(container_type_uri, QT4_UI_URI) @@ -254,8 +250,15 @@ suil_instance_new(SuilHost* host, } // Open wrapper (this may add additional features) - instance->wrapper = open_wrapper( - host, container_type_uri, ui_type_uri, &instance->features, n_features); + if (container_type_uri && strcmp(container_type_uri, ui_type_uri)) { + instance->wrapper = open_wrapper(host, + container_type_uri, ui_type_uri, + &instance->features, n_features); + if (!instance->wrapper) { + suil_instance_free(instance); + return NULL; + } + } // Instantiate UI instance->handle = descriptor->instantiate( -- cgit v1.2.1