Dear all, On Sonntag, 15. Oktober 2017 22:08:52 CEST Berthold Stoeger wrote:
> By the way, there seems to be a strange bug(?): for the first failed > download I get an information window. For each subsequent retry there is an > additional window. E.g. for the 5th failed download it opens 5 information > windows at once. Answering to myself here: The issue seems to be the connect(&thread, SIGNAL(finished()), ...); call in on_downloadCancelRetryButton_clicked(), which apparently is accumulative. Moving this call to the constructor solves the "problem". That being said, I don't understand anything of that Qt SIGNAL/SLOT business. Moreover, there is a second connect call, which perhaps should also be called only once. diff --git a/desktop-widgets/downloadfromdivecomputer.cpp b/desktop-widgets/ downloadfromdivecomputer.cpp index 424cf277..efd414af 100644 --- a/desktop-widgets/downloadfromdivecomputer.cpp +++ b/desktop-widgets/downloadfromdivecomputer.cpp @@ -71,6 +71,9 @@ DownloadFromDCWidget::DownloadFromDCWidget(QWidget *parent, Qt::WindowFlags f) : connect(close, SIGNAL(activated()), this, SLOT(close())); connect(quit, SIGNAL(activated()), parent, SLOT(close())); + connect(&thread, SIGNAL(finished()), + this, SLOT(onDownloadThreadFinished()), Qt::QueuedConnection); + auto dc = SettingsObjectWrapper::instance()->dive_computer_settings; if (!dc->dc_vendor().isEmpty()) { ui.vendor->setCurrentIndex(ui.vendor->findText(dc- >dc_vendor())); @@ -330,9 +333,6 @@ void DownloadFromDCWidget::on_downloadCancelRetryButton_clicked() dc->setDownloadMode(ui.bluetoothMode->isChecked() ? DC_TRANSPORT_BLUETOOTH : DC_TRANSPORT_SERIAL); #endif - connect(&thread, SIGNAL(finished()), - this, SLOT(onDownloadThreadFinished()), Qt::QueuedConnection); - //TODO: Don't call mainwindow. MainWindow *w = MainWindow::instance(); connect(&thread, SIGNAL(finished()), w, SLOT(refreshDisplay())); Berthold _______________________________________________ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface