From a2e328e3dd8cc33fdafde7ed2dfe99aec4b77f1c Mon Sep 17 00:00:00 2001 From: Hyunjin Song Date: Fri, 22 Nov 2019 21:26:47 +0900 Subject: [PATCH] Fix crash on deleting instrument with controller connections on knobs (#5306) Knob::friendlyUpdate() can be called after the model is deleted due to signal-slot connections. Adding a check for the model fixes a crash due to null pointer dereference. --- src/gui/widgets/Knob.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/Knob.cpp b/src/gui/widgets/Knob.cpp index 7b6038449..3932795b7 100644 --- a/src/gui/widgets/Knob.cpp +++ b/src/gui/widgets/Knob.cpp @@ -803,9 +803,9 @@ void Knob::enterValue() void Knob::friendlyUpdate() { - if( model()->controllerConnection() == NULL || + if (model() && (model()->controllerConnection() == NULL || model()->controllerConnection()->getController()->frequentUpdates() == false || - Controller::runningFrames() % (256*4) == 0 ) + Controller::runningFrames() % (256*4) == 0)) { update(); }