Commit d1a1c803 authored by Matěj Laitl's avatar Matěj Laitl
Browse files

QtGroupingProxy: don't re-enter beginInsertRows() (crashfix)

This should fix a nasty crash that was only reproducible when Qt was
build with debugging assertions enabled. (and perhaps only if you have
empty playlist providers) The fix is based on an assumption that
addSourceRow() in QtGroupingProxy is only called from:

a) buildTree(), which encompasses it in {begin/end}ResetModel()
b) modelRowsInserted(), but that should be always preceeded by
   modelRowsAboutToBeInserted() that calls beginInsertRows()

Bart, this is largely your code, is this correct?

BUGFIXES:
 * Fix crash on start when Qt is build with debugging assertions

BUG: 285720
FIXED-IN: 2.6
DIGEST: fix rather nasty crash
parent bf5e84cd
......@@ -77,6 +77,7 @@ VERSION 2.6-Beta 1
"1.2 GB free" is shown instead of "85% used"; thicker capacity bar.
BUGFIXES:
* Fix crash on start when Qt is build with debugging assertions. (BR 285720)
* Fix URLs in MP3tunes, gpodder.net and Last.fm config dialogs. (BR 299088)
* Fix drag & drop in playlist layout editor, filename layout editor and
filter editor for non-english locales. (BR 215402)
......
......@@ -220,23 +220,15 @@ QtGroupingProxy::addSourceRow( const QModelIndex &idx )
{
int &rowValue = groupList[insertedProxyRow-1];
if( idx.row() <= rowValue )
{
//increment the rows that come after the new row since they moved one place up.
rowValue++;
}
else
{
break;
}
}
if( updatedGroups.contains( i.key() ) )
{
//the row needs to be added to this group
beginInsertRows( index( i.key() ), insertedProxyRow, insertedProxyRow );
// we're inside beginInsertRows() or beginInsertRows(), don't re-enter it.
groupList.insert( insertedProxyRow, idx.row() );
endInsertRows();
}
}
return updatedGroups;
......
......@@ -38,7 +38,7 @@ class QtGroupingProxy : public QAbstractProxyModel
void setGroupedColumn( int groupedColumn );
/* QAbstractProxyModel methods */
virtual QModelIndex index( int, int c = 0,
virtual QModelIndex index( int row, int column = 0,
const QModelIndex& parent = QModelIndex() ) const;
virtual Qt::ItemFlags flags( const QModelIndex &idx ) const;
virtual QModelIndex parent( const QModelIndex &idx ) const;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment