mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-01-17 14:28:24 +01:00
Store Result's own weakref, so it can convert back to the existing sharedptr from itself.
This commit is contained in:
parent
bb1e856955
commit
5f393ebc3d
@ -69,6 +69,7 @@ Result::get( const QString& url, const track_ptr& track )
|
||||
}
|
||||
|
||||
result_ptr r = result_ptr( new Result( url, track ), &Result::deleteLater );
|
||||
r->setWeakRef( r.toWeakRef() );
|
||||
s_results.insert( url, r );
|
||||
|
||||
return r;
|
||||
@ -271,8 +272,7 @@ Result::toQuery()
|
||||
m_query = query->weakRef();
|
||||
|
||||
QList<Tomahawk::result_ptr> rl;
|
||||
rl << Result::get( m_url, m_track );
|
||||
|
||||
rl << weakRef().toStrongRef();
|
||||
query->addResults( rl );
|
||||
query->setResolveFinished( true );
|
||||
return query;
|
||||
@ -518,3 +518,18 @@ Result::track() const
|
||||
{
|
||||
return m_track;
|
||||
}
|
||||
|
||||
|
||||
QWeakPointer<Result>
|
||||
Result::weakRef()
|
||||
{
|
||||
return m_ownRef;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Result::setWeakRef( QWeakPointer<Result> weakRef )
|
||||
{
|
||||
m_ownRef = weakRef;
|
||||
}
|
||||
|
||||
|
@ -64,6 +64,9 @@ public:
|
||||
|
||||
virtual ~Result();
|
||||
|
||||
QWeakPointer< Tomahawk::Result > weakRef();
|
||||
void setWeakRef( QWeakPointer< Tomahawk::Result > weakRef );
|
||||
|
||||
QVariant toVariant() const;
|
||||
QString toString() const;
|
||||
Tomahawk::query_ptr toQuery();
|
||||
@ -159,6 +162,7 @@ private:
|
||||
|
||||
track_ptr m_track;
|
||||
query_wptr m_query;
|
||||
QWeakPointer< Tomahawk::Result > m_ownRef;
|
||||
};
|
||||
|
||||
} //ns
|
||||
|
Loading…
x
Reference in New Issue
Block a user