From 2b2505683f9dd91b6f2f8aeb1ac0798c975a53d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Touceda?= Date: Fri, 19 Jul 2013 11:35:27 -0300 Subject: Workaround segfault when emitting a signal with a None parameter Also, support a response from requests be None in certain places. --- src/leap/crypto/srpregister.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/leap/crypto') diff --git a/src/leap/crypto/srpregister.py b/src/leap/crypto/srpregister.py index 24f73504..de1978b5 100644 --- a/src/leap/crypto/srpregister.py +++ b/src/leap/crypto/srpregister.py @@ -124,7 +124,12 @@ class SRPRegister(QtCore.QObject): logger.debug('Post to uri: %s' % uri) logger.debug("Will try to register user = %s" % (username,)) - ok = None + ok = False + # This should be None, but we don't like when PySide segfaults, + # so it something else. + # To reproduce it, just do: + # self.registration_finished.emit(False, None) + req = [] try: req = self._session.post(uri, data=user_data, @@ -132,12 +137,13 @@ class SRPRegister(QtCore.QObject): verify=self._provider_config. get_ca_cert_path()) - except requests.exceptions.SSLError as exc: - logger.error("SSLError: %s" % exc.message) - req = None + except (requests.exceptions.SSLError, + requests.exceptions.ConnectionError) as exc: + logger.error(exc.message) ok = False else: ok = req.ok + self.registration_finished.emit(ok, req) return ok -- cgit v1.2.3