Reverted change that introduced a crash.

If there are ssl erros with unpaired devices, link was null.

This reverts commit 7da30ddbb1.
This commit is contained in:
Albert Vaca 2016-08-03 22:01:04 +02:00
parent fa293e6d8a
commit 50496a3442
2 changed files with 6 additions and 5 deletions

View file

@ -287,8 +287,6 @@ void LanLinkProvider::sslErrors(const QList<QSslError>& errors)
disconnect(socket, SIGNAL(encrypted()), this, SLOT(encrypted()));
disconnect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(sslErrors(QList<QSslError>)));
QString deviceId = socket->peerVerifyName();
Q_FOREACH (const QSslError &error, errors) {
switch (error.error()) {
case QSslError::CertificateSignatureFailed:
@ -297,8 +295,11 @@ void LanLinkProvider::sslErrors(const QList<QSslError>& errors)
case QSslError::CertificateUntrusted:
case QSslError::SelfSignedCertificate: {
qCDebug(KDECONNECT_CORE) << "Failing due to " << error.errorString();
LanPairingHandler* ph = createPairingHandler(mLinks.value(deviceId));
ph->unpair();
// Due to simultaneous multiple connections, it may be possible that device instance does not exist anymore
Device *device = Daemon::instance()->getDevice(socket->peerVerifyName());
if (device != Q_NULLPTR) {
device->unpair();
}
break;
}
default:
@ -394,6 +395,7 @@ void LanLinkProvider::deviceLinkDestroyed(QObject* destroyedDeviceLink)
mLinks.erase(linkIterator);
mPairingHandlers.remove(id);
}
}
void LanLinkProvider::configureSslSocket(QSslSocket* socket, const QString& deviceId, bool isDeviceTrusted)

View file

@ -52,7 +52,6 @@ public:
virtual void reportError(const QString &title, const QString &description) = 0;
virtual QNetworkAccessManager* networkAccessManager();
protected:
Device* getDevice(const QString& deviceId);
public Q_SLOTS: