https://bugs.kde.org/show_bug.cgi?id=328359

--- Comment #69 from m_loui...@yahoo.com ---
The crash is caused by this code around
musicbrainz/MusicBrainzTagsModel.cpp:205:

if( !index.isValid() || !parent( index ).isValid() )
  [...] static_cast<MusicBrainzTagsItem *>(
index.internalPointer())->childCount() [...]

ie the internal pointer of an invalid item is dereferenced. Checking that the
pointer in not null before using it makes the crash go away:

if( !index.isValid() || !parent( index ).isValid() )
{
    // Disable items with no children.
    MusicBrainzTagsItem *item = static_cast<MusicBrainzTagsItem *>(
index.internalPointer() );
    if ( !item || item->childCount() == 0 )
        return QAbstractItemModel::flags( index ) ^ Qt::ItemIsEnabled;
}

When the crash is gone, empty rows show up in the track list. The corresponding
QModelIndex are invalid, and I think these are the ones created in
MusicBrainzTagsModel::index when childItem is null. This should not happen,
because in principle row < parentItem->childCount(), but sometimes it's not the
case.

I suspect the check for !parent.isValid() in MusicBrainzTagsModel::rowCount may
be the root cause of everything, but I was unable to understand how to fix the
problem.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to