From 584e9c92d9a28af6b9f627c40e78cbcc58bac455 Mon Sep 17 00:00:00 2001 From: glubsy Date: Mon, 31 Aug 2020 21:17:08 +0200 Subject: [PATCH] Fix duplicate items in menubar * When recreating the Results window, the menubar had duplicate items added each time. * Removing the underlying C++ object is apparently enough to fix the issue. * SetParent(None) can still be used in case of floating windows --- qt/app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qt/app.py b/qt/app.py index c2032388..12f0cbdf 100644 --- a/qt/app.py +++ b/qt/app.py @@ -366,7 +366,8 @@ class DupeGuru(QObject): self.details_dialog.setParent(None) if self.resultWindow is not None: self.resultWindow.close() - self.resultWindow.setParent(None) + # This is better for tabs, as it takes care of duplicate items in menu bar + self.resultWindow.deleteLater() if self.use_tabs else self.resultWindow.setParent(None) if self.use_tabs: self.resultWindow = self.main_window.createPage( "ResultWindow", parent=self.main_window, app=self)