From 5e3adedc6c4de23fe8ef5ee99f3c88977c420329 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Mon, 6 Jan 2014 18:35:51 -0300 Subject: Disconnect signals before closing the wizard. [Closes #4817] --- .../bug-4817_disconnect-signals-on-wizard-close | 1 + src/leap/bitmask/gui/mainwindow.py | 5 +++-- src/leap/bitmask/gui/wizard.py | 23 ++++++++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 changes/bug-4817_disconnect-signals-on-wizard-close diff --git a/changes/bug-4817_disconnect-signals-on-wizard-close b/changes/bug-4817_disconnect-signals-on-wizard-close new file mode 100644 index 00000000..78c14756 --- /dev/null +++ b/changes/bug-4817_disconnect-signals-on-wizard-close @@ -0,0 +1 @@ +- Disconnect signals before closing the wizard. Closes #4817. diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index c05d65fe..1fe2cfca 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -414,7 +414,8 @@ class MainWindow(QtGui.QMainWindow): # setup but does not register self._wizard = None self._backend_connect() - self._finish_init() + if self._wizard_firstrun: + self._finish_init() def _launch_wizard(self): """ @@ -433,7 +434,7 @@ class MainWindow(QtGui.QMainWindow): self._wizard = Wizard(backend=self._backend, bypass_checks=self._bypass_checks) self._wizard.accepted.connect(self._finish_init) - self._wizard.rejected.connect(self._wizard.close) + self._wizard.rejected.connect(self._rejected_wizard) self.setVisible(False) # Do NOT use exec_, it will use a child event loop! diff --git a/src/leap/bitmask/gui/wizard.py b/src/leap/bitmask/gui/wizard.py index ec007110..b99e8db6 100644 --- a/src/leap/bitmask/gui/wizard.py +++ b/src/leap/bitmask/gui/wizard.py @@ -686,3 +686,26 @@ class Wizard(QtGui.QWizard): self.ui.lblUser.setText("") self.ui.lblPassword.setText("") self.ui.lblPassword2.setText("") + + def closeEvent(self, event): + """ + This method is called when the wizard dialog is closed. + We disconnect all the backend signals in here. + """ + try: + # disconnect backend signals + self._backend.signaler.prov_name_resolution.disconnect( + self._name_resolution) + self._backend.signaler.prov_https_connection.disconnect( + self._https_connection) + self._backend.signaler.prov_download_provider_info.disconnect( + self._download_provider_info) + + self._backend.signaler.prov_download_ca_cert.disconnect( + self._download_ca_cert) + self._backend.signaler.prov_check_ca_fingerprint.disconnect( + self._check_ca_fingerprint) + self._backend.signaler.prov_check_api_certificate.disconnect( + self._check_api_certificate) + except RuntimeError: + pass # Signal was not connected -- cgit v1.2.3