aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-06-08 17:33:40 +0000
committerDavid Robillard <d@drobilla.net>2013-06-08 17:33:40 +0000
commit3501582c83f9abe27cc23a6a0526d1ddfa4138d9 (patch)
treed1d7a671b14a1e815960f106de3a8c0917073469
parent6ec945342aac10c99b88a25b732b3bb989ebca9d (diff)
downloadjalv-3501582c83f9abe27cc23a6a0526d1ddfa4138d9.tar.gz
jalv-3501582c83f9abe27cc23a6a0526d1ddfa4138d9.tar.bz2
jalv-3501582c83f9abe27cc23a6a0526d1ddfa4138d9.zip
Probably fix thread safety of debug printing (#911).
git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@5122 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--NEWS1
-rw-r--r--src/jalv.c6
-rw-r--r--src/jalv_internal.h1
3 files changed, 6 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 3a6d67f..bb67c12 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
jalv (1.4.1) unstable;
* Fix crash when running "jalv" with bad command line arguments
+ * Fix potential crash with UIs and debug printing
* Add command-line option to control UI update frequency
* Support rsz:minimumSize for atom and event ports
* Fix default setting for non-sequential enumeration ports
diff --git a/src/jalv.c b/src/jalv.c
index 7e8097a..946f98e 100644
--- a/src/jalv.c
+++ b/src/jalv.c
@@ -763,7 +763,7 @@ jalv_emit_ui_events(Jalv* jalv)
SerdNode p = serd_node_from_string(SERD_URI, USTR(NS_RDF "value"));
LV2_Atom* atom = (LV2_Atom*)buf;
char* str = sratom_to_turtle(
- jalv->sratom, &jalv->unmap, "jalv:", &s, &p,
+ jalv->ui_sratom, &jalv->unmap, "jalv:", &s, &p,
atom->type, atom->size, LV2_ATOM_BODY(atom));
printf("\n## Plugin => UI (%u bytes) ##\n%s\n", atom->size, str);
free(str);
@@ -819,7 +819,8 @@ main(int argc, char** argv)
lv2_atom_forge_init(&jalv.forge, &jalv.map);
- jalv.sratom = sratom_new(&jalv.map);
+ jalv.sratom = sratom_new(&jalv.map);
+ jalv.ui_sratom = sratom_new(&jalv.map);
jalv.midi_event_id = uri_to_id(
&jalv, "http://lv2plug.in/ns/ext/event", LV2_MIDI__MidiEvent);
@@ -1164,6 +1165,7 @@ main(int argc, char** argv)
zix_sem_destroy(&jalv.symap_lock);
suil_host_free(jalv.ui_host);
sratom_free(jalv.sratom);
+ sratom_free(jalv.ui_sratom);
lilv_uis_free(jalv.uis);
lilv_world_free(world);
diff --git a/src/jalv_internal.h b/src/jalv_internal.h
index 619be63..8b41581 100644
--- a/src/jalv_internal.h
+++ b/src/jalv_internal.h
@@ -164,6 +164,7 @@ typedef struct {
LV2_URID_Map map; ///< URI => Int map
LV2_URID_Unmap unmap; ///< Int => URI map
Sratom* sratom; ///< Atom serialiser
+ Sratom* ui_sratom; ///< Atom serialiser for UI thread
Symap* symap; ///< URI map
ZixSem symap_lock; ///< Lock for URI map
jack_client_t* jack_client; ///< Jack client