From: Olivier Goffart Date: Tue, 28 Mar 2017 13:11:58 +0000 (+0200) Subject: AccountState: Attempt to fix a crash X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~773^2~29 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=85afa4788b7ad16d1959a9660ba16b4393601345;p=nextcloud-desktop.git AccountState: Attempt to fix a crash Backtrace from the crash reporter: Crash: EXCEPTION_ACCESS_VIOLATION_READ at 0x21 File "qcoreapplication.cpp", line 1281, in QCoreApplication::postEvent File "qobject.cpp", line 2125, in QObject::deleteLater File "connectionvalidator.cpp", line 240, in OCC::ConnectionValidator::reportResult File "connectionvalidator.cpp", line 206, in OCC::ConnectionValidator::slotAuthFailed File "moc_connectionvalidator.cpp", line 127, in OCC::ConnectionValidator::qt_static_metacall File "qobject.cpp", line 3716, in QMetaObject::activate File "moc_networkjobs.cpp", line 653, in OCC::PropfindJob::finishedWithError File "networkjobs.cpp", line 570, in OCC::PropfindJob::finished I believe the problem is caused because 'this' was deleted in ConnectionValidator::reportResult as the signal connectionResult gets emited. The AccountState::slotConnectionValidatorResult slot does indeed call slotInvalidCredentials which might call {Shibboleth,Http}Credentials::fetchFromKeychain which might emit fetched directly, which will call AccountState::slotCredentialsFetched which deletes the _connectionValidator So use deleteLater when deleting the _connectionValidator, hoping this helps --- diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp index 38bae16a9..fb2dc5360 100644 --- a/src/gui/accountstate.cpp +++ b/src/gui/accountstate.cpp @@ -281,9 +281,12 @@ void AccountState::slotCredentialsFetched(AbstractCredentials* credentials) _waitingForNewCredentials = false; - // When new credentials become available we always want to restart the - // connection validation, even if it's currently running. - delete _connectionValidator; + if (_connectionValidator) { + // When new credentials become available we always want to restart the + // connection validation, even if it's currently running. + _connectionValidator->deleteLater(); + _connectionValidator = 0; + } checkConnectivity(); } @@ -298,9 +301,12 @@ void AccountState::slotCredentialsAsked(AbstractCredentials* credentials) return; } - // When new credentials become available we always want to restart the - // connection validation, even if it's currently running. - delete _connectionValidator; + if (_connectionValidator) { + // When new credentials become available we always want to restart the + // connection validation, even if it's currently running. + _connectionValidator->deleteLater(); + _connectionValidator = 0; + } checkConnectivity(); }