Bug 229240

Summary: Amarok: playlist: crash when selecting song using enter after searching [@ QSortFilterProxyModelPrivate::proxy_to_source]
Product: amarok Reporter: Wizzleby
Component: PlaylistAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: crash CC: brzionline, hein, infamune, krzysztof.dzida, langstr, nhn, peter.llorens, teo
Priority: VHI    
Version: 2.3-GIT   
Target Milestone: 2.3.0   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: New crash information added by DrKonqi

Description Wizzleby 2010-03-03 12:29:40 UTC
Version:           2.2-GIT (using 4.4.1 (KDE 4.4.1), Gentoo)
Compiler:          x86_64-pc-linux-gnu-gcc
OS:                Linux (x86_64) release 2.6.32-zen6

Using amarok-GIT built 2010-March-03,
can be reproduced by searching for a song in the playlist interface, hitting enter when a song has been hilighted.

segfault occurs.

Backtrace follows:

#0  0x00007ffff5de643b in QSortFilterProxyModel::parent(QModelIndex const&) const () from /usr/lib64/qt4/libQtGui.so.4
#1  0x00007ffff5db35c3 in QItemSelection::select(QModelIndex const&, QModelIndex const&) () from /usr/lib64/qt4/libQtGui.so.4
#2  0x00007ffff5db395d in QItemSelection::QItemSelection(QModelIndex const&, QModelIndex const&) () from /usr/lib64/qt4/libQtGui.so.4
#3  0x00007ffff5db3999 in QItemSelectionModel::select(QModelIndex const&, QFlags<QItemSelectionModel::SelectionFlag>) () from /usr/lib64/qt4/libQtGui.so.4
#4  0x00007ffff5db22e7 in QItemSelectionModel::setCurrentIndex(QModelIndex const&, QFlags<QItemSelectionModel::SelectionFlag>) () from /usr/lib64/qt4/libQtGui.so.4
#5  0x00007ffff6f07ff1 in Playlist::PrettyListView::trackActivated (this=0x11fecd0, idx=...)
    at /var/tmp/portage/media-sound/amarok-9999/work/amarok-9999/src/playlist/view/listview/PrettyListView.cpp:259
#6  0x00007ffff6f08069 in Playlist::PrettyListView::playFirstSelected (this=0x11fecd0)
    at /var/tmp/portage/media-sound/amarok-9999/work/amarok-9999/src/playlist/view/listview/PrettyListView.cpp:157
#7  0x00007ffff6f0a108 in Playlist::PrettyListView::qt_metacall (this=0x11fecd0, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fffffffa3f0)
    at /var/tmp/portage/media-sound/amarok-9999/work/amarok-9999_build/src/PrettyListView.moc:121
#8  0x00007ffff64a0fdf in QMetaObject::activate (sender=0x76dce0, m=<value optimized out>, local_signal_index=<value optimized out>, argv=0x130b760)
    at kernel/qobject.cpp:3285
#9  0x00007ffff6e97bee in Playlist::ProgressiveSearchWidget::qt_metacall (this=0x76dce0, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fffffffa550)
    at /var/tmp/portage/media-sound/amarok-9999/work/amarok-9999_build/src/ProgressiveSearchWidget.moc:114
#10 0x00007ffff64a0fdf in QMetaObject::activate (sender=0x10c17c0, m=<value optimized out>, local_signal_index=<value optimized out>, argv=0x130b760)
    at kernel/qobject.cpp:3285
#11 0x00007ffff7a92ca5 in KLineEdit::returnPressed (this=0x7fffffff9fc0, _t1=<value optimized out>)
    at /var/tmp/portage/kde-base/kdelibs-4.4.1-r1/work/kdelibs-4.4.1_build/kdeui/klineedit.moc:226
#12 0x00007ffff7a97f7c in KLineEdit::event (this=0x10c17c0, ev=0x7fffffffac50)
    at /var/tmp/portage/kde-base/kdelibs-4.4.1-r1/work/kdelibs-4.4.1/kdeui/widgets/klineedit.cpp:1308
#13 0x00007ffff5835f0c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/qt4/libQtGui.so.4
#14 0x00007ffff583dce5 in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/qt4/libQtGui.so.4
#15 0x00007ffff71dca36 in App::notify (this=0x7fffffff9fc0, receiver=0x130b760, event=0x1ef1a90)
    at /var/tmp/portage/media-sound/amarok-9999/work/amarok-9999/src/App.cpp:917
#16 0x00007ffff648e26b in QCoreApplication::notifyInternal (this=0x7fffffffbb90, receiver=0x10c17c0, event=0x7fffffffac50) at kernel/qcoreapplication.cpp:704
#17 0x00007ffff58df7f3 in QKeyMapper::sendKeyEvent(QWidget*, bool, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, QString const&, bool, int, unsigned int, unsigned int, unsigned int, bool*) () from /usr/lib64/qt4/libQtGui.so.4
#18 0x00007ffff58e1cb1 in QKeyMapperPrivate::translateKeyEvent(QWidget*, _XEvent const*, bool) () from /usr/lib64/qt4/libQtGui.so.4
#19 0x00007ffff58bb014 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib64/qt4/libQtGui.so.4
#20 0x00007ffff58e4d1a in x11EventSourceDispatch(_GSource*, int (*)(void*), void*) () from /usr/lib64/qt4/libQtGui.so.4
#21 0x00007fffed0b67e3 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#22 0x00007fffed0ba010 in g_main_context_iterate () from /usr/lib/libglib-2.0.so.0
#23 0x00007fffed0ba128 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#24 0x00007ffff64b763e in QEventDispatcherGlib::processEvents (this=0x621e60, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:412
#25 0x00007ffff58e4926 in QGuiEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtGui.so.4
#26 0x00007ffff648cb92 in QEventLoop::processEvents (this=<value optimized out>, flags=
DWARF-2 expression error: DW_OP_reg operations must be used either alone or in conjuction with DW_OP_piece.
) at kernel/qeventloop.cpp:149
#27 0x00007ffff648cf5d in QEventLoop::exec (this=0x7fffffffbb30, flags=
DWARF-2 expression error: DW_OP_reg operations must be used either alone or in conjuction with DW_OP_piece.
) at kernel/qeventloop.cpp:201
#28 0x00007ffff6490c3b in QCoreApplication::exec () at kernel/qcoreapplication.cpp:981
#29 0x00000000004088c1 in main (argc=<value optimized out>, argv=0x7fffffffdb08) at /var/tmp/portage/media-sound/amarok-9999/work/amarok-9999/src/main.cpp:237
Comment 1 Mikko C. 2010-03-04 12:12:15 UTC
Just reproduce with today's git master.
Better bt:

[KCrash Handler]
#5  QSortFilterProxyModelPrivate::proxy_to_source (this=0x2395060, proxy_index=...) at itemviews/qsortfilterproxymodel.cpp:332
#6  0x00007fb8f869d62d in QSortFilterProxyModel::mapToSource (this=<value optimized out>, proxyIndex=...) at itemviews/qsortfilterproxymodel.cpp:2454
#7  0x00007fb8f869b859 in QSortFilterProxyModel::buddy (this=0x0, index=...) at itemviews/qsortfilterproxymodel.cpp:1957
#8  0x00007fb8f86187c1 in QAbstractItemViewPrivate::sendDelegateEvent (this=0x2615430, index=..., event=0x0) at itemviews/qabstractitemview.cpp:4013
#9  0x00007fb8f8618b66 in QAbstractItemView::edit (this=0x2615380, index=..., trigger=QAbstractItemView::CurrentChanged, event=0x0) at itemviews/qabstractitemview.cpp:2483
#10 0x00007fb8f8612364 in QAbstractItemView::currentChanged (this=0x2615380, current=..., previous=<value optimized out>) at itemviews/qabstractitemview.cpp:3349
#11 0x00007fb8f8618553 in QAbstractItemView::qt_metacall (this=0x2615380, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fff4c5dced0)
    at .moc/debug-shared/moc_qabstractitemview.cpp:238
#12 0x00007fb8f87a3c97 in QListView::qt_metacall (this=0x7fff4c5dca40, _c=QMetaObject::InvokeMetaMethod, _id=50412192, _a=0x0) at .moc/debug-shared/moc_qlistview.cpp:111
#13 0x00007fb8f97a1a47 in Playlist::PrettyListView::qt_metacall (this=0x2615380, _c=QMetaObject::InvokeMetaMethod, _id=51, _a=0x7fff4c5dced0) at /home/mikko/amarok/build/src/PrettyListView.moc:113
#14 0x00007fb8f8d1e9a1 in QMetaObject::activate (sender=0x261b010, m=<value optimized out>, local_signal_index=<value optimized out>, argv=0x0) at kernel/qobject.cpp:3285
#15 0x00007fb8f8666a0a in QItemSelectionModel::currentChanged (this=0x7fff4c5dca40, _t1=<value optimized out>, _t2=<value optimized out>) at .moc/debug-shared/moc_qitemselectionmodel.cpp:159
#16 0x00007fb8f8666ba0 in QItemSelectionModel::setCurrentIndex (this=0x261b010, index=<value optimized out>, command=) at itemviews/qitemselectionmodel.cpp:1167
#17 0x00007fb8f979d494 in Playlist::PrettyListView::trackActivated (this=0x2615380, idx=...) at /home/mikko/amarok/src/playlist/view/listview/PrettyListView.cpp:259
#18 0x00007fb8f979c976 in Playlist::PrettyListView::playFirstSelected (this=0x2615380) at /home/mikko/amarok/src/playlist/view/listview/PrettyListView.cpp:157
#19 0x00007fb8f97a1ad0 in Playlist::PrettyListView::qt_metacall (this=0x2615380, _c=QMetaObject::InvokeMetaMethod, _id=3, _a=0x7fff4c5dd150) at /home/mikko/amarok/build/src/PrettyListView.moc:121
#20 0x00007fb8f8d1e9a1 in QMetaObject::activate (sender=0x260c080, m=<value optimized out>, local_signal_index=<value optimized out>, argv=0x0) at kernel/qobject.cpp:3285
#21 0x00007fb8f9735857 in Playlist::ProgressiveSearchWidget::activateFilterResult (this=0x260c080) at /home/mikko/amarok/build/src/ProgressiveSearchWidget.moc:175
#22 0x00007fb8f97354d2 in Playlist::ProgressiveSearchWidget::qt_metacall (this=0x260c080, _c=QMetaObject::InvokeMetaMethod, _id=5, _a=0x7fff4c5dd2e0)
    at /home/mikko/amarok/build/src/ProgressiveSearchWidget.moc:114
#23 0x00007fb8f8d1e9a1 in QMetaObject::activate (sender=0x25f84a0, m=<value optimized out>, local_signal_index=<value optimized out>, argv=0x0) at kernel/qobject.cpp:3285
#24 0x00007fb8fa361c45 in KLineEdit::returnPressed (this=0x7fff4c5dca40, _t1=<value optimized out>) at /var/tmp/paludis/kde-base-kdelibs-9999/work/kdelibs-9999_build/kdeui/klineedit.moc:226
#25 0x00007fb8fa36360c in KLineEdit::event (this=0x25f84a0, ev=0x7fff4c5dd950) at /var/tmp/paludis/kde-base-kdelibs-9999/work/kdelibs-9999/kdeui/widgets/klineedit.cpp:1308
#26 0x00007fb8f8110b5c in QApplicationPrivate::notify_helper (this=0x1cd5440, receiver=0x25f84a0, e=0x7fff4c5dd950) at kernel/qapplication.cpp:4300
#27 0x00007fb8f811a5fb in QApplication::notify (this=<value optimized out>, receiver=0x25f84a0, e=0x7fff4c5dd950) at kernel/qapplication.cpp:3763
#28 0x00007fb8f9a7493e in App::notify (this=0x7fff4c5de720, receiver=0x25f84a0, event=0x7fff4c5dd950) at /home/mikko/amarok/src/App.cpp:917
#29 0x00007fb8f8d08dcb in QCoreApplication::notifyInternal (this=0x7fff4c5de720, receiver=0x25f84a0, event=0x7fff4c5dd950) at kernel/qcoreapplication.cpp:704
#30 0x00007fb8f81b4cd7 in QKeyMapper::sendKeyEvent (keyWidget=0x25f84a0, grab=<value optimized out>, type=<value optimized out>, code=16777220, modifiers=<value optimized out>, text=..., 
    autorepeat=false, count=1, nativeScanCode=36, nativeVirtualKey=65293, nativeModifiers=0) at kernel/qkeymapper_x11.cpp:1861
#31 0x00007fb8f81b7a91 in QKeyMapperPrivate::translateKeyEvent (this=0x1d13150, keyWidget=0x25f84a0, event=<value optimized out>, grab=false) at kernel/qkeymapper_x11.cpp:1831
#32 0x00007fb8f8191738 in QApplication::x11ProcessEvent (this=<value optimized out>, event=0x7fff4c5de530) at kernel/qapplication_x11.cpp:3394
#33 0x00007fb8f81b99aa in QEventDispatcherX11::processEvents (this=<value optimized out>, flags=<value optimized out>) at kernel/qeventdispatcher_x11.cpp:132
#34 0x00007fb8f8d075b2 in QEventLoop::processEvents (this=<value optimized out>, flags=) at kernel/qeventloop.cpp:149
#35 0x00007fb8f8d0797d in QEventLoop::exec (this=0x7fff4c5de6c0, flags=) at kernel/qeventloop.cpp:201
#36 0x00007fb8f8d09edb in QCoreApplication::exec () at kernel/qcoreapplication.cpp:981
#37 0x000000000040b002 in main (argc=1, argv=0x7fff4c5e0688) at /home/mikko/amarok/src/main.cpp:237
Comment 2 langstr 2010-03-04 15:57:07 UTC
I created the following patch which fixes the problem for me.

However, it might be a workaround rather than a fix: 'selectedIndexes()' appears to return a QModelIndex that 'setCurrentIndex()' / 'QItemSelectionModel' chokes on. That shouldn't happen in an ideal world.

I suspect that it might possibly be a bug / unintented interaction in Qt: it might be that 'setCurrentIndex()' removes internal state from under the QModelIndex still being passed around.

If that wild guess is correct, this 'idxCopy' would be slightly more proper to do in 'playFirstSelected()'.

But I don't know any of this code well, and don't intend to pursue it further.

Cheers, Nanno



  Playlist::PrettyListView::trackActivated( const QModelIndex& idx )
  {
      DEBUG_BLOCK
      m_skipAutoScroll = true; // we don't want to do crazy view changes when selecting an item in the view
      Actions::instance()->play( idx );
  
      //make sure that the track we just activated is also set as the current index or
      //the selected index will get moved to the first row, making keyboard navigation difficult (BUG 225791)
-    selectionModel()->setCurrentIndex( idx, QItemSelectionModel::ClearAndSelect );
+    QModelIndex idxCopy = model()->index( idx.row(), idx.column() );
+    selectionModel()->setCurrentIndex( idxCopy, QItemSelectionModel::ClearAndSelect );
-
  }
Comment 3 Nikolaj Hald Nielsen 2010-03-15 10:38:56 UTC
I cannot reproduce this with 2.3. Anyone else have more luck?
Comment 4 langstr 2010-03-15 10:44:59 UTC
Mark Kretschmann merged my Merge Request 145 containing the fix/workaround, on 2010-03-07.
Comment 5 Nikolaj Hald Nielsen 2010-03-15 11:02:54 UTC
Ah! In that case...
Comment 6 Sven Krohlas 2010-04-21 00:10:04 UTC
*** Bug 234662 has been marked as a duplicate of this bug. ***
Comment 7 Sven Krohlas 2010-04-21 00:10:17 UTC
*** Bug 231133 has been marked as a duplicate of this bug. ***
Comment 8 Sven Krohlas 2010-04-25 22:54:10 UTC
*** Bug 235290 has been marked as a duplicate of this bug. ***
Comment 9 Sven Krohlas 2010-05-24 14:44:47 UTC
*** Bug 238604 has been marked as a duplicate of this bug. ***
Comment 10 Murda 2010-05-26 08:45:11 UTC
Created attachment 43897 [details]
New crash information added by DrKonqi

moving the mouse on the playlist (with no clicking) when crash happened.

i noticed that if i rightclick>add song or folders (from the file manager or the collection) amarok play, but then if i click on the playlist it crashes.
Comment 11 langstr 2010-05-26 10:57:53 UTC
Sven Krohlas has marked 4 other bug reports as "Duplicate" of this bug report.

However, the crash path of these 4 other bugs is somewhat different: it does not contain the 'setCurrentIndex()' call involved in this bug.

The 4 other bug reports have 1 thing in common: they all use Qt 4.7, which is not (yet) a released version of Qt.

Given the observations, I think that there's a significant chance of a bug
in Qt 4.7 beta.

It could be a bug in Amarok, but I think that's less likely.

Reporters, I recommend that you tell Nokia/Trolltech about your crashes.