1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-14 01:54:07 +02:00

Don't store a source_ptr in SourcePlaylistInterface, since the Source has a playlistinterface_ptr down to it, causing a loop

This commit is contained in:
Jeff Mitchell
2011-12-21 14:35:10 -05:00
parent d3fbbf778a
commit daca5fa107
2 changed files with 7 additions and 7 deletions

View File

@@ -28,7 +28,7 @@ using namespace Tomahawk;
SourcePlaylistInterface::SourcePlaylistInterface( Tomahawk::source_ptr& source ) SourcePlaylistInterface::SourcePlaylistInterface( Tomahawk::source_ptr& source )
: PlaylistInterface( this ) : PlaylistInterface( this )
, m_source( source ) , m_source( source.data() )
, m_currentItem( 0 ) , m_currentItem( 0 )
, m_gotNextItem( false ) , m_gotNextItem( false )
{ {
@@ -52,7 +52,7 @@ Tomahawk::result_ptr
SourcePlaylistInterface::nextItem() SourcePlaylistInterface::nextItem()
{ {
tDebug( LOGEXTRA ) << Q_FUNC_INFO; tDebug( LOGEXTRA ) << Q_FUNC_INFO;
if ( m_source.isNull() || m_source->currentTrack().isNull() || m_source->currentTrack()->results().isEmpty() ) if ( m_source.isNull() || m_source.data()->currentTrack().isNull() || m_source.data()->currentTrack()->results().isEmpty() )
{ {
tDebug( LOGEXTRA ) << Q_FUNC_INFO << " Results were empty for current track or source no longer valid"; tDebug( LOGEXTRA ) << Q_FUNC_INFO << " Results were empty for current track or source no longer valid";
m_currentItem = Tomahawk::result_ptr(); m_currentItem = Tomahawk::result_ptr();
@@ -65,7 +65,7 @@ SourcePlaylistInterface::nextItem()
} }
m_gotNextItem = false; m_gotNextItem = false;
m_currentItem = m_source->currentTrack()->results().first(); m_currentItem = m_source.data()->currentTrack()->results().first();
return m_currentItem; return m_currentItem;
} }
@@ -81,7 +81,7 @@ bool
SourcePlaylistInterface::hasNextItem() SourcePlaylistInterface::hasNextItem()
{ {
tDebug( LOGEXTRA ) << Q_FUNC_INFO; tDebug( LOGEXTRA ) << Q_FUNC_INFO;
if ( m_source.isNull() || m_source->currentTrack().isNull() || m_source->currentTrack()->results().isEmpty() ) if ( m_source.isNull() || m_source.data()->currentTrack().isNull() || m_source.data()->currentTrack()->results().isEmpty() )
return false; return false;
return m_gotNextItem; return m_gotNextItem;
@@ -96,7 +96,7 @@ SourcePlaylistInterface::tracks()
} }
source_ptr QWeakPointer< Tomahawk::Source >
SourcePlaylistInterface::source() const SourcePlaylistInterface::source() const
{ {
return m_source; return m_source;

View File

@@ -57,7 +57,7 @@ public:
virtual bool shuffled() const { return false; } virtual bool shuffled() const { return false; }
virtual void setFilter( const QString& /*pattern*/ ) {} virtual void setFilter( const QString& /*pattern*/ ) {}
virtual Tomahawk::source_ptr source() const; virtual QWeakPointer< Tomahawk::Source > source() const;
virtual void reset(); virtual void reset();
@@ -77,7 +77,7 @@ private slots:
void resolvingFinished( bool hasResults ); void resolvingFinished( bool hasResults );
private: private:
Tomahawk::source_ptr m_source; QWeakPointer< Tomahawk::Source > m_source;
Tomahawk::result_ptr m_currentItem; Tomahawk::result_ptr m_currentItem;
bool m_gotNextItem; bool m_gotNextItem;
}; };