From e02a63b0616d75c5d6b4f8894d3b25e8b732f784 Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Thu, 9 Jul 2020 21:36:31 -0400 Subject: [PATCH] Prevent crash if focus widget gets deleted during saving * Fixes #4966 --- src/gui/DatabaseWidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index 61f2b2163..042e2a561 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -1813,7 +1813,7 @@ bool DatabaseWidget::save() m_blockAutoSave = true; ++m_saveAttempts; - auto focusWidget = qApp->focusWidget(); + QPointer focusWidget(qApp->focusWidget()); // TODO: Make this async // Lock out interactions @@ -1887,7 +1887,7 @@ bool DatabaseWidget::saveAs() bool ok = false; if (!newFilePath.isEmpty()) { - auto focusWidget = qApp->focusWidget(); + QPointer focusWidget(qApp->focusWidget()); // Lock out interactions m_entryView->setDisabled(true);