aboutsummaryrefslogtreecommitdiff
path: root/sandbox_ui.lv2
diff options
context:
space:
mode:
authorGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2018-05-03 08:48:54 +0200
committerGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2018-05-03 08:48:54 +0200
commite3e929887bec72ea6e92b5976eabb6465daa721a (patch)
tree5019b69098d90ad7131418326fab7b963e69601e /sandbox_ui.lv2
parent7efebbf62195481bab59bf9552053d353d356b36 (diff)
downloadsynthpod-e3e929887bec72ea6e92b5976eabb6465daa721a.zip
synthpod-e3e929887bec72ea6e92b5976eabb6465daa721a.tar.gz
synthpod-e3e929887bec72ea6e92b5976eabb6465daa721a.tar.bz2
synthpod-e3e929887bec72ea6e92b5976eabb6465daa721a.tar.xz
sbox: gracefully exit slave when init fails.
Diffstat (limited to 'sandbox_ui.lv2')
-rw-r--r--sandbox_ui.lv2/sandbox_slave.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sandbox_ui.lv2/sandbox_slave.c b/sandbox_ui.lv2/sandbox_slave.c
index a7b2ec4..a9dc1d2 100644
--- a/sandbox_ui.lv2/sandbox_slave.c
+++ b/sandbox_ui.lv2/sandbox_slave.c
@@ -75,6 +75,8 @@ struct _sandbox_slave_t {
const sandbox_slave_driver_t *driver;
void *data;
+ bool initialized;
+
const char *plugin_urn;
const char *plugin_uri;
const char *plugin_bundle_path;
@@ -483,7 +485,7 @@ sandbox_slave_new(int argc, char **argv, const sandbox_slave_driver_t *driver, v
if(_sandbox_io_init(&sb->io, sb->map, sb->unmap, sb->socket_path, false, false))
{
- fprintf(stderr, "_sandbox_io_init failed\n");
+ fprintf(stderr, "_sandbox_io_init failed: are you sure that the host is running?\n");
goto fail;
}
@@ -493,6 +495,7 @@ sandbox_slave_new(int argc, char **argv, const sandbox_slave_driver_t *driver, v
goto fail;
}
+ sb->initialized = true;
return sb; // success
fail:
@@ -506,10 +509,10 @@ sandbox_slave_free(sandbox_slave_t *sb)
if(!sb)
return;
- if(sb->desc && sb->desc->cleanup)
+ if(sb->desc && sb->desc->cleanup && sb->handle)
sb->desc->cleanup(sb->handle);
- if(sb->driver && sb->driver->deinit_cb)
+ if(sb->driver && sb->driver->deinit_cb && sb->initialized)
sb->driver->deinit_cb(sb->data);
_sandbox_io_deinit(&sb->io, false);