Guard against segfaults due to out-of-order dialog deletion

This commit is contained in:
Chris Hennes
2021-02-05 15:38:24 +01:00
committed by wmayer
parent aa52a3f55c
commit 9c9244dfb3
+10
View File
@@ -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);