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.
This commit is contained in:
glubsy 2021-04-16 17:54:49 +02:00
parent d18b8c10ec
commit 6b4b436251
2 changed files with 4 additions and 1 deletions

View File

@ -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

View File

@ -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