mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-10 08:04:25 +02:00
Proxy the QtConncurrent call to a static function to preserve a strong ref
This commit is contained in:
@@ -82,7 +82,7 @@ void
|
||||
ConnectionManager::handleSipInfo( const Tomahawk::peerinfo_ptr &peerInfo )
|
||||
{
|
||||
// Start handling in a separate thread so that we do not block the event loop.
|
||||
QtConcurrent::run( this, &ConnectionManager::handleSipInfoPrivate, peerInfo );
|
||||
QtConcurrent::run( &ConnectionManager::handleSipInfoPrivateS, peerInfo, weakRef().toStrongRef() );
|
||||
}
|
||||
|
||||
QWeakPointer<ConnectionManager>
|
||||
@@ -264,6 +264,12 @@ ConnectionManager::socketError( QAbstractSocket::SocketError error )
|
||||
tryConnect();
|
||||
}
|
||||
|
||||
void
|
||||
ConnectionManager::handleSipInfoPrivateS( const Tomahawk::peerinfo_ptr &peerInfo, const QSharedPointer<ConnectionManager> &connectionManager )
|
||||
{
|
||||
connectionManager->handleSipInfoPrivate( peerInfo );
|
||||
}
|
||||
|
||||
void
|
||||
ConnectionManager::activate()
|
||||
{
|
||||
|
@@ -53,6 +53,9 @@ private:
|
||||
Q_DECLARE_PRIVATE( ConnectionManager )
|
||||
ConnectionManagerPrivate* d_ptr;
|
||||
|
||||
// Proxy to hand over a strong reference to the connectionManager
|
||||
static void handleSipInfoPrivateS( const Tomahawk::peerinfo_ptr& peerInfo, const QSharedPointer<ConnectionManager>& connectionManager );
|
||||
|
||||
void activate();
|
||||
void deactivate();
|
||||
void connectToPeer(const Tomahawk::peerinfo_ptr& peerInfo , bool lock);
|
||||
|
Reference in New Issue
Block a user