Skip to content

Commit a09448e

Browse files
authored
Merge pull request #13165 from daschuer/gh13164
Remove autdated ASSERT fixing #13164
2 parents 518533c + efa0224 commit a09448e

3 files changed

Lines changed: 7 additions & 27 deletions

File tree

src/library/basesqltablemodel.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ class BaseSqlTableModel : public BaseTrackTableModel {
9797

9898
TrackCollectionManager* const m_pTrackCollectionManager;
9999

100-
protected:
101100
QList<TrackRef> getTrackRefs(const QModelIndexList& indices) const;
102101

103102
QSqlDatabase m_database;

src/library/basetracktablemodel.cpp

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -472,18 +472,6 @@ QVariant BaseTrackTableModel::data(
472472
return roleValue(index, rawValue(index), role);
473473
}
474474

475-
QVariant BaseTrackTableModel::rawValue(
476-
const QModelIndex& index) const {
477-
VERIFY_OR_DEBUG_ASSERT(index.isValid()) {
478-
return QVariant();
479-
}
480-
const auto field = mapColumn(index.column());
481-
if (field == ColumnCache::COLUMN_LIBRARYTABLE_INVALID) {
482-
return QVariant();
483-
}
484-
return rawSiblingValue(index, field);
485-
}
486-
487475
QVariant BaseTrackTableModel::rawSiblingValue(
488476
const QModelIndex& index,
489477
ColumnCache::Column siblingField) const {
@@ -493,17 +481,13 @@ QVariant BaseTrackTableModel::rawSiblingValue(
493481
VERIFY_OR_DEBUG_ASSERT(siblingField != ColumnCache::COLUMN_LIBRARYTABLE_INVALID) {
494482
return QVariant();
495483
}
496-
const auto siblingColumn = fieldIndex(siblingField);
484+
const int siblingColumn = fieldIndex(siblingField);
497485
if (siblingColumn < 0) {
498486
// Unsupported or unknown column/field
499487
// FIXME: This should never happen but it does. But why??
500488
return QVariant();
501489
}
502-
VERIFY_OR_DEBUG_ASSERT(siblingColumn != index.column()) {
503-
// Prevent infinite recursion
504-
return QVariant();
505-
}
506-
const auto siblingIndex = index.sibling(index.row(), siblingColumn);
490+
const QModelIndex siblingIndex = index.sibling(index.row(), siblingColumn);
507491
return rawValue(siblingIndex);
508492
}
509493

src/library/basetracktablemodel.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,6 @@ class BaseTrackTableModel : public QAbstractTableModel, public TrackModel {
162162
virtual Qt::ItemFlags readWriteFlags(
163163
const QModelIndex& index) const;
164164

165-
/// At least one of the following functions must be overridden,
166-
/// because each default implementation will call the other
167-
/// function!!
168-
///
169165
/// Return the raw data value at the given index.
170166
///
171167
/// Expected types by ColumnCache field (pass-through = not validated):
@@ -211,10 +207,7 @@ class BaseTrackTableModel : public QAbstractTableModel, public TrackModel {
211207
/// COLUMN_LIBRARYTABLE_LAST_PLAYED_AT: QDateTime
212208
/// COLUMN_PLAYLISTTABLE_DATETIMEADDED: QDateTime
213209
virtual QVariant rawValue(
214-
const QModelIndex& index) const;
215-
virtual QVariant rawSiblingValue(
216-
const QModelIndex& index,
217-
ColumnCache::Column siblingField) const;
210+
const QModelIndex& index) const = 0;
218211

219212
QVariant roleValue(
220213
const QModelIndex& index,
@@ -250,6 +243,10 @@ class BaseTrackTableModel : public QAbstractTableModel, public TrackModel {
250243
const QPixmap& pixmap);
251244

252245
private:
246+
QVariant rawSiblingValue(
247+
const QModelIndex& index,
248+
ColumnCache::Column siblingField) const;
249+
253250
// Track models may reference tracks by an external id
254251
// TODO: TrackId should only be used for tracks from
255252
// the internal database.

0 commit comments

Comments
 (0)