zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit d384e3236b6399562c301eb25269f7bc9ae066e9
parent 06379db2c46249c3f6e0656e13e810ece6fb4d0e
Author: fundamental <mark.d.mccurry@gmail.com>
Date:   Wed,  3 Sep 2014 12:50:43 -0400

Nio: Fix Segfault In JackEngine

Adds Null checks in cleanup of jack engine code on close.
This fixes a possible segfault under -I jack -O oss with whatever is
currently installed on freebsd.
This patch is by Hans Petter Selasky

Diffstat:
Msrc/Nio/JackEngine.cpp | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/Nio/JackEngine.cpp b/src/Nio/JackEngine.cpp @@ -238,16 +238,18 @@ void JackEngine::stopAudio() for(int i = 0; i < 2; ++i) { jack_port_t *port = audio.ports[i]; audio.ports[i] = NULL; - if(NULL != port) + if(jackClient != NULL && NULL != port) jack_port_unregister(jackClient, port); } midi.jack_sync = false; if(osc.oscport) { - jack_port_unregister(jackClient, osc.oscport); + if (jackClient != NULL) { + jack_port_unregister(jackClient, osc.oscport); #ifdef JACK_HAS_METADATA_API - jack_uuid_t uuid = jack_port_uuid(osc.oscport); - jack_remove_property(jackClient, uuid, "http://jackaudio.org/metadata/event-types"); + jack_uuid_t uuid = jack_port_uuid(osc.oscport); + jack_remove_property(jackClient, uuid, "http://jackaudio.org/metadata/event-types"); #endif // JACK_HAS_METADATA_API + } } if(!getMidiEn()) disconnectJack();