mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 19:30:21 +02:00
Store model pointers in a QPointer for safety.
This commit is contained in:
@@ -566,3 +566,10 @@ GridView::onScrollTimeout()
|
||||
m_proxyModel->updateDetailedInfo( m_proxyModel->index( i, 0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PlayableModel*
|
||||
GridView::model() const
|
||||
{
|
||||
return m_model.data();
|
||||
}
|
||||
|
@@ -52,7 +52,7 @@ public:
|
||||
|
||||
void setProxyModel( PlayableProxyModel* model );
|
||||
|
||||
PlayableModel* model() const { return m_model; }
|
||||
PlayableModel* model() const;
|
||||
PlayableProxyModel* proxyModel() const { return m_proxyModel; }
|
||||
GridItemDelegate* delegate() const { return m_delegate; }
|
||||
|
||||
@@ -117,7 +117,7 @@ private slots:
|
||||
void verifySize();
|
||||
|
||||
private:
|
||||
PlayableModel* m_model;
|
||||
QPointer<PlayableModel> m_model;
|
||||
PlayableProxyModel* m_proxyModel;
|
||||
GridItemDelegate* m_delegate;
|
||||
AnimatedSpinner* m_loadingSpinner;
|
||||
|
@@ -137,7 +137,7 @@ private:
|
||||
bool visibilityFilterAcceptsRow( int sourceRow, const QModelIndex& sourceParent, PlayableProxyModelFilterMemo& memo ) const;
|
||||
bool lessThan( int column, const Tomahawk::query_ptr& left, const Tomahawk::query_ptr& right ) const;
|
||||
|
||||
PlayableModel* m_model;
|
||||
QPointer<PlayableModel> m_model;
|
||||
|
||||
bool m_showOfflineResults;
|
||||
bool m_hideEmptyParents;
|
||||
|
@@ -941,3 +941,10 @@ TrackView::selectFirstTrack()
|
||||
currentChanged( idx, QModelIndex() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PlayableModel*
|
||||
TrackView::model() const
|
||||
{
|
||||
return m_model.data();
|
||||
}
|
||||
|
@@ -53,7 +53,7 @@ public:
|
||||
virtual void setModel( QAbstractItemModel* model );
|
||||
void setProxyModel( PlayableProxyModel* model );
|
||||
|
||||
virtual PlayableModel* model() const { return m_model; }
|
||||
virtual PlayableModel* model() const;
|
||||
PlayableProxyModel* proxyModel() const { return m_proxyModel; }
|
||||
PlaylistItemDelegate* delegate() const { return m_delegate; }
|
||||
ViewHeader* header() const { return m_header; }
|
||||
@@ -143,7 +143,7 @@ private:
|
||||
void updateHoverIndex( const QPoint& pos );
|
||||
|
||||
QString m_guid;
|
||||
PlayableModel* m_model;
|
||||
QPointer<PlayableModel> m_model;
|
||||
PlayableProxyModel* m_proxyModel;
|
||||
PlaylistItemDelegate* m_delegate;
|
||||
ViewHeader* m_header;
|
||||
|
@@ -45,7 +45,7 @@ TreeProxyModel::TreeProxyModel( QObject* parent )
|
||||
void
|
||||
TreeProxyModel::setSourcePlayableModel( TreeModel* model )
|
||||
{
|
||||
if ( sourceModel() )
|
||||
if ( m_model )
|
||||
{
|
||||
disconnect( m_model, SIGNAL( rowsInserted( QModelIndex, int, int ) ), this, SLOT( onRowsInserted( QModelIndex, int, int ) ) );
|
||||
disconnect( m_model, SIGNAL( modelReset() ), this, SLOT( onModelReset() ) );
|
||||
@@ -54,7 +54,7 @@ TreeProxyModel::setSourcePlayableModel( TreeModel* model )
|
||||
PlayableProxyModel::setSourcePlayableModel( model );
|
||||
m_model = model;
|
||||
|
||||
if ( sourceModel() )
|
||||
if ( m_model )
|
||||
{
|
||||
connect( m_model, SIGNAL( rowsInserted( QModelIndex, int, int ) ), SLOT( onRowsInserted( QModelIndex, int, int ) ) );
|
||||
connect( m_model, SIGNAL( modelReset() ), SLOT( onModelReset() ) );
|
||||
|
@@ -78,7 +78,7 @@ private:
|
||||
Tomahawk::ArtistsRequest* m_artistsFilterCmd;
|
||||
|
||||
QString m_filter;
|
||||
TreeModel* m_model;
|
||||
QPointer<TreeModel> m_model;
|
||||
};
|
||||
|
||||
#endif // TREEPROXYMODEL_H
|
||||
|
Reference in New Issue
Block a user