From 6b4b436251068d38486cade2de0acc859cc4d55a Mon Sep 17 00:00:00 2001 From: glubsy Date: Fri, 16 Apr 2021 17:54:49 +0200 Subject: [PATCH] Fix crash on shutdown * Fixes "'DetailsPanel' object has no attribute '_table'" error on shutdown if the Results table is updated (item removed) while the Details Dialog is shown as a floating window. * It seems that QApplication.quit() triggers some sort of refresh on the floating QDockWidget, which in turn makes calls to the underlying model that is possibly being destroyed, ie. there might be a race condition here. * Closing or hiding the QDockWidget before the cal to quit() is a workaround. Similarly, this is already done in the quitTriggered() method anyway. * This fixes #857. --- qt/app.py | 3 +++ qt/details_dialog.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/qt/app.py b/qt/app.py index 7d9891e8..47051ea9 100644 --- a/qt/app.py +++ b/qt/app.py @@ -271,6 +271,9 @@ class DupeGuru(QObject): self.willSavePrefs.emit() self.prefs.save() self.model.save() + # Workaround for #857, hide() or close(). + if self.details_dialog is not None: + self.details_dialog.close() QApplication.quit() # --- Signals diff --git a/qt/details_dialog.py b/qt/details_dialog.py index c39f81e2..3c31fa55 100644 --- a/qt/details_dialog.py +++ b/qt/details_dialog.py @@ -51,7 +51,7 @@ class DetailsDialog(QDockWidget): if not self.titleBarWidget(): # default title bar self.setTitleBarWidget(QWidget()) # disables title bar # Windows (and MacOS?) users cannot move a floating window which - # has not native decoration so we force it to dock for now + # has no native decoration so we force it to dock for now if not ISLINUX: self.setFloating(False) elif self.titleBarWidget() is not None: # title bar is disabled