Bug 141762 - moving song on top in dynamic playlist crashes amarok
Summary: moving song on top in dynamic playlist crashes amarok
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: Playlist (show other bugs)
Version: 1.4.5
Platform: Gentoo Packages Linux
: NOR crash
Target Milestone: ---
Assignee: Amarok Developers
URL:
Keywords:
: 143472 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-02-15 23:58 UTC by sero4linux
Modified: 2007-03-27 19:26 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sero4linux 2007-02-15 23:58:56 UTC
Version:           1.4.5 (using KDE KDE 3.5.5)
Installed from:    Gentoo Packages
OS:                Linux

1.I create a new playlist via playlists sidebar -> dynamic playlist -> random mix.
2.I drag and drop one item from that playlist on top of the list (so it becomes the first song in the list).
3.Amarok crashes instantly and I can reproduce the crash everytime. It doesn't matter whether the playlist is actually playing or not.
Comment 1 richlv 2007-02-21 18:35:15 UTC
confirmed in 1.4 revision 633720. nasty :)
here's a bt :

(gdb) bt
#0  0xb7cc50f8 in PlaylistItem::isDynamicEnabled (this=0x0) at playlistitem.h:67
#1  0xb7cb6b0b in Playlist::contentsDropEvent (this=0x820ed00, e=0xbff145a0) at playlist.cpp:2438
#2  0xb6695467 in QScrollView::viewportDropEvent () from /usr/lib/qt/lib/libqt-mt.so.3
#3  0xb669768f in QScrollView::eventFilter () from /usr/lib/qt/lib/libqt-mt.so.3
#4  0xb6664618 in QListView::eventFilter () from /usr/lib/qt/lib/libqt-mt.so.3
#5  0xb7cb9098 in Playlist::eventFilter (this=0x820ed00, o=0x820f578, e=0xbff145a0) at playlist.cpp:2946
#6  0xb657338f in QObject::activate_filters () from /usr/lib/qt/lib/libqt-mt.so.3
#7  0xb6573464 in QObject::event () from /usr/lib/qt/lib/libqt-mt.so.3
#8  0xb65af7df in QWidget::event () from /usr/lib/qt/lib/libqt-mt.so.3
#9  0xb651146f in QApplication::internalNotify () from /usr/lib/qt/lib/libqt-mt.so.3
#10 0xb651160c in QApplication::notify () from /usr/lib/qt/lib/libqt-mt.so.3
#11 0xb6b5cac5 in KApplication::notify () from /opt/kde/lib/libkdecore.so.4
#12 0xb64b922a in qt_handle_xdnd_drop () from /usr/lib/qt/lib/libqt-mt.so.3
#13 0xb64b931e in QDragManager::drop () from /usr/lib/qt/lib/libqt-mt.so.3
#14 0xb64bb1a5 in QDragManager::eventFilter () from /usr/lib/qt/lib/libqt-mt.so.3
#15 0xb65114d3 in QApplication::internalNotify () from /usr/lib/qt/lib/libqt-mt.so.3
#16 0xb65116c6 in QApplication::notify () from /usr/lib/qt/lib/libqt-mt.so.3
#17 0xb6b5cac5 in KApplication::notify () from /opt/kde/lib/libkdecore.so.4
#18 0xb64ab39b in QETWidget::translateMouseEvent () from /usr/lib/qt/lib/libqt-mt.so.3
#19 0xb64a9821 in QApplication::x11ProcessEvent () from /usr/lib/qt/lib/libqt-mt.so.3
#20 0xb64bcf25 in QEventLoop::processEvents () from /usr/lib/qt/lib/libqt-mt.so.3
#21 0xb6527b91 in QEventLoop::enterLoop () from /usr/lib/qt/lib/libqt-mt.so.3
#22 0xb65105ff in QApplication::enter_loop () from /usr/lib/qt/lib/libqt-mt.so.3
#23 0xb64bae52 in QDragManager::drag () from /usr/lib/qt/lib/libqt-mt.so.3
#24 0xb651f31c in QDragObject::drag () from /usr/lib/qt/lib/libqt-mt.so.3
#25 0xb651f277 in QDragObject::drag () from /usr/lib/qt/lib/libqt-mt.so.3
#26 0xb6e8dd84 in KListView::startDrag () from /opt/kde/lib/libkdeui.so.4
#27 0xb666c094 in QListView::contentsMouseMoveEvent () from /usr/lib/qt/lib/libqt-mt.so.3
#28 0xb6e877bf in KListView::contentsMouseMoveEvent () from /opt/kde/lib/libkdeui.so.4
#29 0xb7cbffa9 in Playlist::contentsMouseMoveEvent (this=0x820ed00, e=0xbff15270) at playlist.cpp:4112
#30 0xb66951f5 in QScrollView::viewportMouseMoveEvent () from /usr/lib/qt/lib/libqt-mt.so.3
#31 0xb6697747 in QScrollView::eventFilter () from /usr/lib/qt/lib/libqt-mt.so.3
#32 0xb6664618 in QListView::eventFilter () from /usr/lib/qt/lib/libqt-mt.so.3
#33 0xb7cb9098 in Playlist::eventFilter (this=0x820ed00, o=0x820f578, e=0xbff15b80) at playlist.cpp:2946
#34 0xb657338f in QObject::activate_filters () from /usr/lib/qt/lib/libqt-mt.so.3
#35 0xb6573464 in QObject::event () from /usr/lib/qt/lib/libqt-mt.so.3
#36 0xb65af7df in QWidget::event () from /usr/lib/qt/lib/libqt-mt.so.3
#37 0xb651146f in QApplication::internalNotify () from /usr/lib/qt/lib/libqt-mt.so.3
#38 0xb65116c6 in QApplication::notify () from /usr/lib/qt/lib/libqt-mt.so.3
#39 0xb6b5cac5 in KApplication::notify () from /opt/kde/lib/libkdecore.so.4
#40 0xb64ab39b in QETWidget::translateMouseEvent () from /usr/lib/qt/lib/libqt-mt.so.3
#41 0xb64a9821 in QApplication::x11ProcessEvent () from /usr/lib/qt/lib/libqt-mt.so.3
#42 0xb64bcf25 in QEventLoop::processEvents () from /usr/lib/qt/lib/libqt-mt.so.3
#43 0xb6527b91 in QEventLoop::enterLoop () from /usr/lib/qt/lib/libqt-mt.so.3
#44 0xb6527ae6 in QEventLoop::exec () from /usr/lib/qt/lib/libqt-mt.so.3
#45 0xb65105cf in QApplication::exec () from /usr/lib/qt/lib/libqt-mt.so.3
#46 0x0804cef2 in main (argc=1, argv=0xbff16254) at main.cpp:114
Comment 2 Dan Meltzer 2007-03-25 06:27:02 UTC
Also confirmed here.  Some additional information:
I could not reproduce on a dynamic playlist that had been going for a while already, it had to be a new dynamic playlist.  On dynamic playlists with a history the song just disappeared when I dropped it, but no crash.

Another bt:

======== DEBUG INFORMATION  =======
Version:    1.4-SVN
Engine:     xine-engine
Build date: Mar 22 2007
CC version: 4.1.1 (Gentoo 4.1.1-r3)
KDElibs:    3.5.6
Qt:         3.3.8
TagLib:     1.4.0
CPU count:  1

==== file `which amarokapp` =======
/usr/kde/3.5/bin/amarokapp: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), not stripped


==== (gdb) bt =====================
Using host libthread_db library "/lib/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread -1258699056 (LWP 15437)]
[New Thread -1319953520 (LWP 17306)]
[New Thread -1283376240 (LWP 17305)]
[New Thread -1378690160 (LWP 17304)]
[New Thread -1272493168 (LWP 15448)]
0xffffe410 in __kernel_vsyscall ()
#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb5f9d2cb in ?? () from /lib/libpthread.so.0
#2  0x0804e0bf in Amarok::Crash::crashHandler ()
    at /home/hydrogen/amarok-svn/amarok/src/amarokcore/crashhandler.cpp:249
#3  <signal handler called>
#4  0xb7cf1a7e in PlaylistItem::isDynamicEnabled (this=0x0)
    at /home/hydrogen/amarok-svn/amarok/src/playlistitem.h:67
#5  0xb7cec738 in Playlist::contentsDropEvent (this=0x8194c40, e=0xbff3324c)
    at /home/hydrogen/amarok-svn/amarok/src/playlist.cpp:2422
#6  0xb67f2fe7 in QScrollView::viewportDropEvent (this=0x8194c40, 
    e=0xbff3324c) at widgets/qscrollview.cpp:1845
#7  0xb67f42e2 in QScrollView::eventFilter (this=0x8194c40, obj=0x8195470, 
    e=0xbff3324c) at widgets/qscrollview.cpp:1539
#8  0xb67c30f6 in QListView::eventFilter (this=0x8194c40, o=0x8195470, 
    e=0xbff3324c) at widgets/qlistview.cpp:3867
#9  0xb7ce4b54 in Playlist::eventFilter (this=0x8194c40, o=0x8195470, 
    e=0xbff3324c) at /home/hydrogen/amarok-svn/amarok/src/playlist.cpp:2930
#10 0xb66e214c in QObject::activate_filters (this=0x8195470, e=0xbff3324c)
    at kernel/qobject.cpp:903
#11 0xb66e21bb in QObject::event (this=0x8195470, e=0xbff3324c)
    at kernel/qobject.cpp:735
#12 0xb671b34c in QWidget::event (this=0x8195470, e=0xbff3324c)
    at kernel/qwidget.cpp:4659
#13 0xb66837e7 in QApplication::internalNotify (this=0xbff34918, 
    receiver=0x8195470, e=0xbff3324c) at kernel/qapplication.cpp:2635
#14 0xb6684361 in QApplication::notify (this=0xbff34918, receiver=0x8195470, 
    e=0xbff3324c) at kernel/qapplication.cpp:2358
#15 0xb6c842be in KApplication::notify (this=0xbff34918, receiver=0x8195470, 
    event=0xbff3324c) at kapplication.cpp:550
#16 0xb662fa4b in qt_handle_xdnd_drop (xe=0xbff332ac, passive=false)
    at kernel/qapplication.h:496
#17 0xb662fc37 in QDragManager::drop (this=0x8ffd900)
    at kernel/qdnd_x11.cpp:1442
#18 0xb6631b10 in QDragManager::eventFilter (this=0x8ffd900, o=0x8a9c290, 
    e=0xbff3364c) at kernel/qdnd_x11.cpp:990
#19 0xb66837ab in QApplication::internalNotify (this=0xbff34918, 
    receiver=0x8a9c290, e=0xbff3364c) at kernel/qapplication.cpp:2568
#20 0xb6684539 in QApplication::notify (this=0xbff34918, receiver=0x8a9c290, 
    e=0xbff3364c) at kernel/qapplication.cpp:2421
#21 0xb6c842be in KApplication::notify (this=0xbff34918, receiver=0x8a9c290, 
    event=0xbff3364c) at kapplication.cpp:550
#22 0xb6623fa2 in QETWidget::translateMouseEvent (this=0x8a9c290, 
    event=0xbff339d8) at kernel/qapplication.h:499
#23 0xb662386f in QApplication::x11ProcessEvent (this=0xbff34918, 
    event=0xbff339d8) at kernel/qapplication_x11.cpp:3449
#24 0xb663384a in QEventLoop::processEvents (this=0x8097ef8, 
    flags=<value optimized out>) at kernel/qeventloop_x11.cpp:192
#25 0xb6699ee0 in QEventLoop::enterLoop (this=0x8097ef8)
    at kernel/qeventloop.cpp:198
#26 0xb66831ef in QApplication::enter_loop (this=0xbff34918)
    at kernel/qapplication.cpp:2793
#27 0xb6631851 in QDragManager::drag (this=0x8ffd900, o=0x8f64fd8, 
    mode=QDragObject::DragDefault) at kernel/qdnd_x11.cpp:1803
#28 0xb66913b6 in QDragObject::drag (this=0x8f64fd8, 
    mode=QDragObject::DragDefault) at kernel/qdragobject.cpp:550
#29 0xb66910d9 in QDragObject::drag (this=0x8f64fd8)
    at kernel/qdragobject.cpp:472
#30 0xb6f67dc4 in KListView::startDrag (this=0x8194c40) at klistview.cpp:1158
#31 0xb67c418b in QListView::contentsMouseMoveEvent (this=0x8194c40, 
    e=0xbff33d14) at widgets/qlistview.cpp:4680
#32 0xb6f68c82 in KListView::contentsMouseMoveEvent (this=0x8194c40, 
    e=0xbff33d14) at klistview.cpp:811
#33 0xb7cda646 in Playlist::contentsMouseMoveEvent (this=0x8194c40, 
    e=0xbff33d14) at /home/hydrogen/amarok-svn/amarok/src/playlist.cpp:4102
#34 0xb67f6c7f in QScrollView::viewportMouseMoveEvent (this=0x8194c40, 
    e=0xbff344ac) at widgets/qscrollview.cpp:1784
#35 0xb67f41f8 in QScrollView::eventFilter (this=0x8194c40, obj=0x8195470, 
    e=0xbff344ac) at widgets/qscrollview.cpp:1511
#36 0xb67c30f6 in QListView::eventFilter (this=0x8194c40, o=0x8195470, 
    e=0xbff344ac) at widgets/qlistview.cpp:3867
#37 0xb7ce4b54 in Playlist::eventFilter (this=0x8194c40, o=0x8195470, 
    e=0xbff344ac) at /home/hydrogen/amarok-svn/amarok/src/playlist.cpp:2930
#38 0xb66e214c in QObject::activate_filters (this=0x8195470, e=0xbff344ac)
    at kernel/qobject.cpp:903
#39 0xb66e21bb in QObject::event (this=0x8195470, e=0xbff344ac)
    at kernel/qobject.cpp:735
#40 0xb671b34c in QWidget::event (this=0x8195470, e=0xbff344ac)
    at kernel/qwidget.cpp:4659
#41 0xb66837e7 in QApplication::internalNotify (this=0xbff34918, 
    receiver=0x8195470, e=0xbff344ac) at kernel/qapplication.cpp:2635
#42 0xb6684539 in QApplication::notify (this=0xbff34918, receiver=0x8195470, 
    e=0xbff344ac) at kernel/qapplication.cpp:2421
#43 0xb6c842be in KApplication::notify (this=0xbff34918, receiver=0x8195470, 
    event=0xbff344ac) at kapplication.cpp:550
#44 0xb6623fa2 in QETWidget::translateMouseEvent (this=0x8195470, 
    event=0xbff34838) at kernel/qapplication.h:499
#45 0xb662386f in QApplication::x11ProcessEvent (this=0xbff34918, 
    event=0xbff34838) at kernel/qapplication_x11.cpp:3449
#46 0xb663384a in QEventLoop::processEvents (this=0x8097ef8, 
    flags=<value optimized out>) at kernel/qeventloop_x11.cpp:192
#47 0xb6699ee0 in QEventLoop::enterLoop (this=0x8097ef8)
    at kernel/qeventloop.cpp:198
#48 0xb6699d66 in QEventLoop::exec (this=0x8097ef8)
    at kernel/qeventloop.cpp:145
#49 0xb668327f in QApplication::exec (this=0xbff34918)
    at kernel/qapplication.cpp:2758
#50 0x0804d0d2 in main (argc=1, argv=0xbff34aa4)
    at /home/hydrogen/amarok-svn/amarok/src/main.cpp:114
#0  0xffffe410 in __kernel_vsyscall ()
No symbol table info available.
#1  0xb5f9d2cb in ?? () from /lib/libpthread.so.0
No symbol table info available.
#2  0x0804e0bf in Amarok::Crash::crashHandler ()
    at /home/hydrogen/amarok-svn/amarok/src/amarokcore/crashhandler.cpp:249
	pid = 19562
#3  <signal handler called>
No symbol table info available.
#4  0xb7cf1a7e in PlaylistItem::isDynamicEnabled (this=0x0)
    at /home/hydrogen/amarok-svn/amarok/src/playlistitem.h:67
No locals.
#5  0xb7cec738 in Playlist::contentsDropEvent (this=0x8194c40, e=0xbff3324c)
    at /home/hydrogen/amarok-svn/amarok/src/playlist.cpp:2422
	uniquelyNamedStackAllocatedStandardBlock = {m_start = {
    tv_sec = 1174796720, tv_usec = 314976}, 
  m_label = 0xb7eef220 "virtual void Playlist::contentsDropEvent(QDropEvent*)"}
	parent = (class QListViewItem *) 0x0
	after = (class QListViewItem *) 0x0
	__PRETTY_FUNCTION__ = "virtual void Playlist::contentsDropEvent(QDropEvent*)"
#6  0xb67f2fe7 in QScrollView::viewportDropEvent (this=0x8194c40, 
    e=0xbff3324c) at widgets/qscrollview.cpp:1845
No locals.
#7  0xb67f42e2 in QScrollView::eventFilter (this=0x8194c40, obj=0x8195470, 
    e=0xbff3324c) at widgets/qscrollview.cpp:1539
No locals.
#8  0xb67c30f6 in QListView::eventFilter (this=0x8194c40, o=0x8195470, 
    e=0xbff3324c) at widgets/qlistview.cpp:3867
No locals.
#9  0xb7ce4b54 in Playlist::eventFilter (this=0x8194c40, o=0x8195470, 
    e=0xbff3324c) at /home/hydrogen/amarok-svn/amarok/src/playlist.cpp:2930
No locals.
#10 0xb66e214c in QObject::activate_filters (this=0x8195470, e=0xbff3324c)
    at kernel/qobject.cpp:903
	it = {<QPtrListIterator<QObject>> = {<QGListIterator> = {
      list = 0x8195d70, curNode = 0x0}, <No data fields>}, <No data fields>}
	obj = (class QObject *) 0x8194c40
#11 0xb66e21bb in QObject::event (this=0x8195470, e=0xbff3324c)
    at kernel/qobject.cpp:735
No locals.
#12 0xb671b34c in QWidget::event (this=0x8195470, e=0xbff3324c)
    at kernel/qwidget.cpp:4659
No locals.
#13 0xb66837e7 in QApplication::internalNotify (this=0xbff34918, 
    receiver=0x8195470, e=0xbff3324c) at kernel/qapplication.cpp:2635
	consumed = <value optimized out>
#14 0xb6684361 in QApplication::notify (this=0xbff34918, receiver=0x8195470, 
    e=0xbff3324c) at kernel/qapplication.cpp:2358
	res = <value optimized out>
#15 0xb6c842be in KApplication::notify (this=0xbff34918, receiver=0x8195470, 
    event=0xbff3324c) at kapplication.cpp:550
	key = {m_sym = 134954904, m_mod = 3220386252}
	edit = (class QLineEdit *) 0x80b3f98
	medit = (class QTextEdit *) 0xbff33188
	t = Drop
	ic = (class QPixmap *) 0x84571e0
	_selectAll = (const KShortcut &) @0xb6e037ec: {m_nSeqs = 1, 
  m_rgseq = {{m_nKeys = 1 '\001', m_bTriggerOnRelease = 0 '\0', m_rgvar = {{
          m_sym = 97, m_mod = 2}, {m_sym = 0, m_mod = 0}, {m_sym = 0, 
          m_mod = 0}, {m_sym = 0, m_mod = 0}}, d = 0x0}, {m_nKeys = 0 '\0', 
      m_bTriggerOnRelease = 0 '\0', m_rgvar = {{m_sym = 0, m_mod = 0}, {
          m_sym = 0, m_mod = 0}, {m_sym = 0, m_mod = 0}, {m_sym = 0, 
          m_mod = 0}}, d = 0x0}}, d = 0x0}
#16 0xb662fa4b in qt_handle_xdnd_drop (xe=0xbff332ac, passive=false)
    at kernel/qapplication.h:496
	de = {<QEvent> = {<Qt> = {static color0 = @0xb6b495e0, 
      static color1 = @0xb6b495e8, static black = @0xb6b495f0, 
      static white = @0xb6b495f8, static darkGray = @0xb6b49600, 
      static gray = @0xb6b49608, static lightGray = @0xb6b49610, 
      static red = @0xb6b49618, static green = @0xb6b49620, 
      static blue = @0xb6b49628, static cyan = @0xb6b49630, 
      static magenta = @0xb6b49638, static yellow = @0xb6b49640, 
      static darkRed = @0xb6b49648, static darkGreen = @0xb6b49650, 
      static darkBlue = @0xb6b49658, static darkCyan = @0xb6b49660, 
      static darkMagenta = @0xb6b49668, static darkYellow = @0xb6b49670, 
      static arrowCursor = @0xb6b47d40, static upArrowCursor = @0xb6b47d44, 
      static crossCursor = @0xb6b47d48, static waitCursor = @0xb6b47d4c, 
      static ibeamCursor = @0xb6b47d50, static sizeVerCursor = @0xb6b47d54, 
      static sizeHorCursor = @0xb6b47d58, 
      static sizeBDiagCursor = @0xb6b47d5c, 
      static sizeFDiagCursor = @0xb6b47d60, 
      static sizeAllCursor = @0xb6b47d64, static blankCursor = @0xb6b47d68, 
      static splitVCursor = @0xb6b47d6c, static splitHCursor = @0xb6b47d70, 
      static pointingHandCursor = @0xb6b47d74, 
      static forbiddenCursor = @0xb6b47d78, 
      static whatsThisCursor = @0xb6b47d7c, static busyCursor = @0xb6b47d80}, 
    _vptr.QEvent = 0xb6b192c8, t = QEvent::Drop, posted = 0, 
    spont = 0}, <QMimeSource> = {_vptr.QMimeSource = 0xb6b192e4, 
    ser_no = 366, cacheType = QMimeSource::NoCache, cache = {txt = {
        str = 0x3c00006, subtype = 0x0}, gfx = {img = 0x3c00006, 
        pix = 0x0}}}, p = {xp = 65, yp = 2}, act = 0, accpt = 0, 
  accptact = 0, resv = 0, d = 0x0}
	finished = {type = -1229719828, serial = 145343120, 
  send_event = 145343120, display = 0xbff33268, window = 3046609035, 
  message_type = 3047391220, format = -1247571680, data = {
    b = "\220©\bX2
Comment 3 Dan Meltzer 2007-03-25 07:38:29 UTC
More Research:

The problem line is in playlist.h, around line 2242.
           

 if( dynamicMode() && static_cast<PlaylistItem *>(after)->isDynamicEnabled() )
            {
                QPtrList<QListViewItem> items = selectedItems();
                QListViewItem *item;
                for( item = items.first(); item; item = items.next() )
                    static_cast<PlaylistItem *>(item)->setDynamicEnabled( true );
            }

The problem is the check does not take into account that (after) could be null, which causes a crash.  I'm not quite sure the proper fix, while the crash when away by wrapping this block in an if ( after ) statement, I'm afraid of possible sideeeffects that may cause and so will wait for someone more familiar w/ dynamic mode to take a look.
Comment 4 Mark Kretschmann 2007-03-26 06:00:37 UTC
*** Bug 143472 has been marked as a duplicate of this bug. ***
Comment 5 Mark Kretschmann 2007-03-26 10:41:14 UTC
Hey guys, I've committed a possible fix for this problem (CC'ing the bug report did not work due to KDE server problems). 

Could you please test if the crash is fixed now, and if there are any side effects?
Comment 6 Mark Kretschmann 2007-03-26 11:31:13 UTC
SVN commit 646541 by markey:

Fix for crash when an item is moved to the top of the playlist in dynamic mode.

Could you guys test if this fixes the crash, and if it has any side effects?

CCBUG: 141762


 M  +1 -1      playlist.cpp  


--- branches/stable/extragear/multimedia/amarok/src/playlist.cpp #646540:646541
@@ -2419,7 +2419,7 @@
     if ( e->source() == viewport() ) {
         setSorting( NO_SORT ); //disableSorting and saveState()
         movableDropEvent( parent, after );
-        if( dynamicMode() && static_cast<PlaylistItem *>(after)->isDynamicEnabled() )
+        if( dynamicMode() && after && static_cast<PlaylistItem *>(after)->isDynamicEnabled() )
         {
             QPtrList<QListViewItem> items = selectedItems();
             QListViewItem *item;
Comment 7 richlv 2007-03-26 12:06:09 UTC
revision 646608

could not reproduce the crash/hang, but now it is possible to move track in the 'played' area (on top of all played tracks).
given that moving tracks in played area otherwise is disallowed, moving a track on top of playlist probably also should not be possible.
Comment 8 Jeff Mitchell 2007-03-26 21:28:44 UTC
Mark--

I've confirmed that this fixes the bug.  Will close the bug report.

--Jeff

Quoting Mark Kretschmann <markey@web.de>:

> SVN commit 646541 by markey:
>
> Fix for crash when an item is moved to the top of the playlist in   
> dynamic mode.
>
> Could you guys test if this fixes the crash, and if it has any side effects?
>
> CCBUG: 141762
>
>
>  M  +1 -1      playlist.cpp
>
>
> --- branches/stable/extragear/multimedia/amarok/src/playlist.cpp   
> #646540:646541
> @@ -2419,7 +2419,7 @@
>      if ( e->source() == viewport() ) {
>          setSorting( NO_SORT ); //disableSorting and saveState()
>          movableDropEvent( parent, after );
> -        if( dynamicMode() && static_cast<PlaylistItem   
> *>(after)->isDynamicEnabled() )
> +        if( dynamicMode() && after && static_cast<PlaylistItem   
> *>(after)->isDynamicEnabled() )
>          {
>              QPtrList<QListViewItem> items = selectedItems();
>              QListViewItem *item;
>

Comment 9 Jeff Mitchell 2007-03-26 21:45:51 UTC
SVN commit 646857 by mitchell:

Mark's fix for the crash, and fixes Rich's observation of items dropped at the top being dynamic enabled.

BUG:141762


 M  +10 -3     playlist.cpp  


--- branches/stable/extragear/multimedia/amarok/src/playlist.cpp #646856:646857
@@ -2419,13 +2419,20 @@
     if ( e->source() == viewport() ) {
         setSorting( NO_SORT ); //disableSorting and saveState()
         movableDropEvent( parent, after );
-        if( dynamicMode() && after && static_cast<PlaylistItem *>(after)->isDynamicEnabled() )
+        QPtrList<QListViewItem> items = selectedItems();
+        if( dynamicMode() && after )
         {
-            QPtrList<QListViewItem> items = selectedItems();
             QListViewItem *item;
+            bool enabled = static_cast<PlaylistItem *>(after)->isDynamicEnabled();
             for( item = items.first(); item; item = items.next() )
-                static_cast<PlaylistItem *>(item)->setDynamicEnabled( true );
+                    static_cast<PlaylistItem *>(item)->setDynamicEnabled( enabled );
         }
+        else if( dynamicMode() && !after && items.first() == Playlist::instance()->firstChild() )
+        {
+            QListViewItem *item;
+            for( item = items.first(); item; item = items.next() )
+                static_cast<PlaylistItem *>(item)->setDynamicEnabled( false );
+        }
     }
 
     else {
Comment 10 Jeff Mitchell 2007-03-27 19:26:22 UTC
SVN commit 647195 by mitchell:

Don't even allow inserting at the top to begin with.  Thanks to Richv for pointing this out.

CCBUG: 141762


 M  +5 -9      playlist.cpp  


--- branches/stable/extragear/multimedia/amarok/src/playlist.cpp #647194:647195
@@ -2400,12 +2400,14 @@
     QListViewItem *parent = 0;
     QListViewItem *after  = m_marker;
 
-    if( m_marker && !( static_cast<PlaylistItem *>(m_marker)->isDynamicEnabled() ) && dynamicMode() )
+    if( !m_marker || !( static_cast<PlaylistItem *>(m_marker)->isDynamicEnabled() ) && dynamicMode() )
     {
         // If marker is disabled, and there is a current track, or marker is not the last enabled track
         // don't allow inserting
-        if ( m_currentTrack
-            || ( m_marker->itemBelow() && !( static_cast<PlaylistItem *>(m_marker->itemBelow())->isDynamicEnabled() ) ) ) {
+        if( ( m_marker && ( m_currentTrack || ( m_marker->itemBelow() &&
+                            !( static_cast<PlaylistItem *>(m_marker->itemBelow())->isDynamicEnabled() ) ) ) )
+            || (!m_marker ) )
+        {
             slotEraseMarker();
             return;
         }
@@ -2427,12 +2429,6 @@
             for( item = items.first(); item; item = items.next() )
                     static_cast<PlaylistItem *>(item)->setDynamicEnabled( enabled );
         }
-        else if( dynamicMode() && !after && items.first() == Playlist::instance()->firstChild() )
-        {
-            QListViewItem *item;
-            for( item = items.first(); item; item = items.next() )
-                static_cast<PlaylistItem *>(item)->setDynamicEnabled( false );
-        }
     }
 
     else {