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