From a9fc823c46beb7f364236773a9a9bbbe3c431e41 Mon Sep 17 00:00:00 2001 From: Igor Kushnir Date: Mon, 28 Jan 2019 14:43:06 +0200 Subject: [PATCH] Avoid duplicate currentGroupChanged() connection Before this change ScanPopup::applyWordsZoomLevel() was called before the primary connection to ScanPopup::currentGroupChanged() in ScanPopup's constructor. This meant that disconnect() had no effect and connect() established the first connection during the first call to ScanPopup::applyWordsZoomLevel(). This caused 2 issues: 1. Since the connection happened before the filling of ui.groupList in ScanPopup's constructor, the current group in scan popup was always "All" on Goldendict start. 2. Since the connection was not unique, the slot was connected twice to the same signal, and it was actually called twice. The bug was introduced in 92e8c85eeca078a65c6fd4409b1ebd2832fbb55f. --- scanpopup.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scanpopup.cc b/scanpopup.cc index 73bf47f7..be5f6441 100644 --- a/scanpopup.cc +++ b/scanpopup.cc @@ -117,9 +117,6 @@ ScanPopup::ScanPopup( QWidget * parent, translateLineDefaultFont = ui.translateBox->font(); groupListDefaultFont = ui.groupList->font(); - applyZoomFactor(); - applyWordsZoomLevel(); - ui.mainLayout->addWidget( definition ); ui.translateBox->wordList()->attachFinder( &wordFinder ); @@ -331,6 +328,9 @@ ScanPopup::ScanPopup( QWidget * parent, connect( &delayTimer, SIGNAL( timeout() ), this, SLOT( delayShow() ) ); #endif + + applyZoomFactor(); + applyWordsZoomLevel(); } ScanPopup::~ScanPopup()