From d61283ad93a78c57afb6a3c55a87ff7f99568c4f Mon Sep 17 00:00:00 2001 From: fundamental Date: Wed, 18 Nov 2009 08:29:05 -0500 Subject: [PATCH] VirKeyboard: Fixed possible segfault Fix to VirKeyboard, so invalid keys do not get registered. Based upon recommendation by zenon48 in: http://www.kvraudio.com/forum/viewtopic.php?t=266432 (cherry picked from commit b9e7cb07bd00780967c68d17deab2190e18a604d) --- plugins/zynaddsubfx/ChangeLog | 3 +++ plugins/zynaddsubfx/src/UI/VirKeyboard.cc | 2 +- plugins/zynaddsubfx/src/UI/VirKeyboard.fl | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/zynaddsubfx/ChangeLog b/plugins/zynaddsubfx/ChangeLog index faa216df6..3cb7dff39 100644 --- a/plugins/zynaddsubfx/ChangeLog +++ b/plugins/zynaddsubfx/ChangeLog @@ -960,3 +960,6 @@ 28 Oct 2009 (Paul Nasca) - Disable "bw" control on Reverb when Bandwidth mode is not enabled + +18 Nov 2009 (Mark McCurry) + - Fixed segfault in VirKeyBoard diff --git a/plugins/zynaddsubfx/src/UI/VirKeyboard.cc b/plugins/zynaddsubfx/src/UI/VirKeyboard.cc index 25df926ad..af7626428 100644 --- a/plugins/zynaddsubfx/src/UI/VirKeyboard.cc +++ b/plugins/zynaddsubfx/src/UI/VirKeyboard.cc @@ -103,7 +103,7 @@ if ((event==FL_PUSH)||(event==FL_DRAG)||(event==FL_RELEASE)){ }; }; - if (((event==FL_PUSH)||(event==FL_DRAG))&& + if ((keypos!=-1)&&((event==FL_PUSH)||(event==FL_DRAG))&& (Fl::event_shift()==0)) { presskey(kpos,1,1); }; diff --git a/plugins/zynaddsubfx/src/UI/VirKeyboard.fl b/plugins/zynaddsubfx/src/UI/VirKeyboard.fl index 37fe43e5c..2a7ab52eb 100644 --- a/plugins/zynaddsubfx/src/UI/VirKeyboard.fl +++ b/plugins/zynaddsubfx/src/UI/VirKeyboard.fl @@ -138,7 +138,7 @@ if ((event==FL_PUSH)||(event==FL_DRAG)||(event==FL_RELEASE)){ }; }; - if (((event==FL_PUSH)||(event==FL_DRAG))&& + if ((keypos!=-1)&&((event==FL_PUSH)||(event==FL_DRAG))&& (Fl::event_shift()==0)) { presskey(kpos,1,1); };