From 15d5c878f38803d1db7a172255a8f4286079fcea Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Fri, 1 Dec 2017 08:14:44 +0100 Subject: [PATCH] canvas::NasalWidget: don't call unsafe method in destructor Calling a virtual method in a destructor has undefined behaviour. Furthermore passing 'this' to nasal from within the destructor is not safe. 'onRemove' is called for widgets within layouts on destruction anyhow, so no need to call it here again. If widgets are arranged manually without any layout 'onRemoved' should be called upon removing them from a dialog. --- simgear/canvas/layout/NasalWidget.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simgear/canvas/layout/NasalWidget.cxx b/simgear/canvas/layout/NasalWidget.cxx index 79b1be70..65ded50b 100644 --- a/simgear/canvas/layout/NasalWidget.cxx +++ b/simgear/canvas/layout/NasalWidget.cxx @@ -45,7 +45,7 @@ namespace canvas //---------------------------------------------------------------------------- NasalWidget::~NasalWidget() { - onRemove(); + } //----------------------------------------------------------------------------