From fbc8803c371ae8c3771ebc494b97d875d47c2c22 Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Wed, 26 Jun 2013 19:36:14 +0200 Subject: [PATCH] Don't try to acquire lock if we do not have a source anymore. --- src/libtomahawk/network/ControlConnection.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libtomahawk/network/ControlConnection.cpp b/src/libtomahawk/network/ControlConnection.cpp index 25596c327..36e701fb1 100644 --- a/src/libtomahawk/network/ControlConnection.cpp +++ b/src/libtomahawk/network/ControlConnection.cpp @@ -159,9 +159,15 @@ ControlConnection::registerSource() { Q_D( ControlConnection ); QReadLocker sourceLocker( &d->sourceLock ); + if ( d->source.isNull() ) + { + // Not connected to a source anymore, nothing to do. + return; + } + QSharedPointer locker = d->source->acquireLock(); // Only continue if we are still the ControlConnection associated with this source. - if ( !d->source.isNull() && d->source->controlConnection() == this ) + if ( d->source->controlConnection() == this ) { qDebug() << Q_FUNC_INFO << d->source->id(); Source* source = (Source*) sender();