From 73de8eae2422bedae0899ff11d8203178e6f2dbb Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Wed, 28 Jan 2015 15:35:41 -0300 Subject: Enable signal connect/disconnect logic. Now it's working and no longer segfaults, so we can enable safely this feature again. Stop tracking the gui connections on wizard. --- src/leap/bitmask/gui/login.py | 1 + src/leap/bitmask/gui/mainwindow.py | 4 +--- src/leap/bitmask/gui/signaltracker.py | 1 - src/leap/bitmask/gui/wizard.py | 31 +++++++++++++------------------ 4 files changed, 15 insertions(+), 22 deletions(-) (limited to 'src/leap') diff --git a/src/leap/bitmask/gui/login.py b/src/leap/bitmask/gui/login.py index 7487e888..8b764025 100644 --- a/src/leap/bitmask/gui/login.py +++ b/src/leap/bitmask/gui/login.py @@ -538,6 +538,7 @@ class LoginWidget(QtGui.QWidget, SignalTracker): """ self.set_status(self.tr("Succeeded"), error=False) self._set_logged_in() + self.disconnect_and_untrack() if not flags.OFFLINE: self.login_finished.emit() diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index d9c53ef6..a2244020 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -336,7 +336,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker): # XXX does this goes in here? this will be triggered when the login or # wizard requests provider data - # XXX - here segfaults if we did a disconnect_and_untrack conntrack(sig.prov_check_api_certificate, self._get_provider_details) conntrack(sig.prov_get_details, self._provider_get_details) @@ -428,7 +427,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker): Called when the wizard has finished. """ - # NOTE: we used to call _finish_init on wizard finished self.setVisible(True) self._backend_connect(only_tracked=True) @@ -1262,7 +1260,7 @@ class MainWindow(QtGui.QMainWindow, SignalTracker): self._maybe_start_eip() @QtCore.Slot() - def _get_provider_details(self): + def _get_provider_details(self, data): """ TRIGGERS: prov_check_api_certificate diff --git a/src/leap/bitmask/gui/signaltracker.py b/src/leap/bitmask/gui/signaltracker.py index c83359c4..0e3b2dce 100644 --- a/src/leap/bitmask/gui/signaltracker.py +++ b/src/leap/bitmask/gui/signaltracker.py @@ -57,7 +57,6 @@ class SignalTracker(QtCore.QObject): try: signal.disconnect(method) except (TypeError, RuntimeError) as e: - # most likely the signal was not connected logger.warning("Disconnect error: {0!r}".format(e)) logger.warning("Signal: {0!r} -> {1!r}".format(signal, method)) diff --git a/src/leap/bitmask/gui/wizard.py b/src/leap/bitmask/gui/wizard.py index c12e8c2e..a30723f2 100644 --- a/src/leap/bitmask/gui/wizard.py +++ b/src/leap/bitmask/gui/wizard.py @@ -82,9 +82,8 @@ class Wizard(QtGui.QWizard, SignalTracker): self._use_existing_provider = False self.ui.grpCheckProvider.setVisible(False) - conntrack = self.connect_and_track - conntrack(self.ui.btnCheck.clicked, self._check_provider) - conntrack(self.ui.lnProvider.returnPressed, self._check_provider) + self.ui.btnCheck.clicked.connect(self._check_provider) + self.ui.lnProvider.returnPressed.connect(self._check_provider) self._leap_signaler = leap_signaler @@ -96,22 +95,19 @@ class Wizard(QtGui.QWizard, SignalTracker): # this details are set when the provider download is complete. self._provider_details = None - conntrack(self.currentIdChanged, self._current_id_changed) + self.currentIdChanged.connect(self._current_id_changed) - conntrack(self.ui.lnProvider.textChanged, self._enable_check) - conntrack(self.ui.rbNewProvider.toggled, - lambda x: self._enable_check()) - conntrack(self.ui.cbProviders.currentIndexChanged[int], - self._reset_provider_check) + self.ui.lnProvider.textChanged.connect(self._enable_check) + self.ui.rbNewProvider.toggled.connect(lambda x: self._enable_check()) + self.ui.cbProviders.currentIndexChanged[int].connect( + self._reset_provider_check) - conntrack(self.ui.lblUser.returnPressed, self._focus_password) - conntrack(self.ui.lblPassword.returnPressed, - self._focus_second_password) - conntrack(self.ui.lblPassword2.returnPressed, self._register) - conntrack(self.ui.btnRegister.clicked, self._register) + self.ui.lblUser.returnPressed.connect(self._focus_password) + self.ui.lblPassword.returnPressed.connect(self._focus_second_password) + self.ui.lblPassword2.returnPressed.connect(self._register) + self.ui.btnRegister.clicked.connect(self._register) - conntrack(self.ui.rbExistingProvider.toggled, - self._skip_provider_checks) + self.ui.rbExistingProvider.toggled.connect(self._skip_provider_checks) usernameRe = QtCore.QRegExp(USERNAME_REGEX) self.ui.lblUser.setValidator( @@ -136,7 +132,7 @@ class Wizard(QtGui.QWizard, SignalTracker): self._provider_checks_ok = False self._provider_setup_ok = False - conntrack(self.finished, self._wizard_finished) + self.finished.connect(self._wizard_finished) @QtCore.Slot() def _wizard_finished(self): @@ -152,7 +148,6 @@ class Wizard(QtGui.QWizard, SignalTracker): self._provider_setup_ok = False self.ui.lnProvider.setText('') self.ui.grpCheckProvider.setVisible(False) - # HACK FIX: disconnection of signals triggers a segfault on quit self.disconnect_and_untrack() def _load_configured_providers(self): -- cgit v1.2.3