From e300444978bad69c104ce49c862da53dbe682e50 Mon Sep 17 00:00:00 2001 From: Elias Oenal Date: Thu, 19 May 2016 20:34:45 +0200 Subject: [PATCH] Trace: Make popup forms compatible with OSX Qt behaves differently on OSX regarding widget lifetime it seems, causing the addition of a stacked decoder to crash PV. According to Elias, the object popup_form_ gets destroyed, yet it still has the parent popup_ which in turn will destroy it again at the end of its life. Either removing the parent, or the preliminary destruction, fixes the crash. --- pv/view/trace.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pv/view/trace.cpp b/pv/view/trace.cpp index ea443f2..87d3dc1 100644 --- a/pv/view/trace.cpp +++ b/pv/view/trace.cpp @@ -224,10 +224,14 @@ void Trace::create_popup_form() // Clear the layout // Transfer the layout and the child widgets to a temporary widget - // which then goes out of scope destroying the layout and all the child - // widgets. - if (popup_form_) - QWidget().setLayout(popup_form_); + // which we delete after the event was handled. This way, the layout + // and all widgets contained therein are deleted after the event was + // handled, leaving the parent popup_ time to handle the change. + if (popup_form_) { + QWidget *suicidal = new QWidget(); + suicidal->setLayout(popup_form_); + suicidal->deleteLater(); + } // Repopulate the popup popup_form_ = new QFormLayout(popup_); -- 2.30.2