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

This commit is contained in:
Chris Hennes
2021-02-02 22:21:45 -06:00
committed by wmayer
parent 321fd7c840
commit f5f1f476f1

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);