[prev in list] [next in list] [prev in thread] [next in thread] 

List:       amarok-bugs-dist
Subject:    [amarok] [Bug 328359] Amarok crashes when using MusicBrains to update tags [@ MusicBrainzTagsItem::c
From:       <bugzilla_noreply () kde ! org>
Date:       2017-04-01 1:31:50
Message-ID: bug-328359-71684-ZwWtEss1we () http ! bugs ! kde ! org/
[Download RAW message or body]

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

--- Comment #69 from m_louis30@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 the assignee for the bug.=
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic