From 9c9244dfb31db5d28f41dd9474696eb58c68330e Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Tue, 2 Feb 2021 22:21:45 -0600 Subject: [PATCH] Guard against segfaults due to out-of-order dialog deletion --- src/Gui/TaskView/TaskView.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Gui/TaskView/TaskView.cpp b/src/Gui/TaskView/TaskView.cpp index 12fa730d60..a6026d0552 100644 --- a/src/Gui/TaskView/TaskView.cpp +++ b/src/Gui/TaskView/TaskView.cpp @@ -775,6 +775,11 @@ void TaskView::removeTaskWatcher(void) void TaskView::accept() { + if (!ActiveDialog) { // Protect against segfaults due to out-of-order deletions + Base::Console().Warning("ActiveDialog was null in call to TaskView::accept()\n"); + return; + } + // Make sure that if 'accept' calls 'closeDialog' the deletion is postponed until // the dialog leaves the 'accept' method ActiveDialog->setProperty("taskview_accept_or_reject", true); @@ -786,6 +791,11 @@ void TaskView::accept() void TaskView::reject() { + if (!ActiveDialog) { // Protect against segfaults due to out-of-order deletions + Base::Console().Warning("ActiveDialog was null in call to TaskView::reject()\n"); + return; + } + // Make sure that if 'reject' calls 'closeDialog' the deletion is postponed until // the dialog leaves the 'reject' method ActiveDialog->setProperty("taskview_accept_or_reject", true);