Bug 116004

Summary: rightclick->load on directories in files tab crashes amarok
Product: [Applications] amarok Reporter: Rodney Gordon II <meff>
Component: generalAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: 1.3.6   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Rodney Gordon II 2005-11-09 17:04:36 UTC
Version:            (using KDE KDE 3.4.2)
Installed from:    Debian testing/unstable Packages
Compiler:          gcc version 4.0.3 20051023 (prerelease) (Debian 4.0.2-3) 
OS:                Linux

I have several directories filled with anywhere between 4 and 30 .flac audio files. Going under the files tab on the left, if I right-click on a folder and choose "Load" amarok crashes. This is reproducable about 75% of the time.

======== DEBUG INFORMATION  =======
Engine:     xine-engine
Build date: Nov  8 2005
CC version: 4.0.3 20051023 (prerelease) (Debian 4.0.2-3)
KDElibs:    3.4.2
TagLib:     1.4.0
NDEBUG:     true
==== file /usr/lib/amarok/amarokapp =======
/usr/lib/amarok/amarokapp: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.0, dynamically linked (uses shared libs), stripped


==== (gdb) bt =====================
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
`system-supplied DSO at 0xffffe000' has disappeared; keeping its symbols.
[Thread debugging using libthread_db enabled]
[New Thread -1251027232 (LWP 19853)]
[New Thread -1305187408 (LWP 20596)]
[New Thread -1296794704 (LWP 19861)]
[New Thread -1288402000 (LWP 19860)]
[New Thread -1278121040 (LWP 19859)]
[New Thread -1269458000 (LWP 19858)]
[New Thread -1253606480 (LWP 19857)]
0xffffe410 in __kernel_vsyscall ()
#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb732674b in __waitpid_nocancel () from /lib/tls/i686/cmov/libpthread.so.0
#2  0x08214dac in amaroK::Crash::crashHandler ()
#3  <signal handler called>
#4  0xb6a963cf in QListViewItem::takeItem () from /usr/lib/libqt-mt.so.3
#5  0xb6a96973 in QListViewItem::~QListViewItem () from /usr/lib/libqt-mt.so.3
#6  0xb7ae44dd in KListViewItem::~KListViewItem () from /usr/lib/libkdeui.so.4
#7  0x08192b94 in QMapPrivate<QString, KURL>::QMapPrivate ()
#8  0x08197426 in QMapPrivate<QString, QPixmap>::QMapPrivate ()
#9  0xb692edfa in QApplication::sendPostedEvents () from /usr/lib/libqt-mt.so.3
#10 0xb692eed9 in QApplication::sendPostedEvents () from /usr/lib/libqt-mt.so.3
#11 0xb68d08ae in QEventLoop::processEvents () from /usr/lib/libqt-mt.so.3
#12 0xb6945ea2 in QEventLoop::enterLoop () from /usr/lib/libqt-mt.so.3
#13 0xb6945dcb in QEventLoop::exec () from /usr/lib/libqt-mt.so.3
#14 0xb692c305 in QApplication::exec () from /usr/lib/libqt-mt.so.3
#15 0x081f628d in QWizard::setFinish ()
#16 0xb6ee5eb0 in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6
#17 0x080893c1 in ?? ()
#0  0xffffe410 in __kernel_vsyscall ()
No symbol table info available.
#1  0xb732674b in __waitpid_nocancel () from /lib/tls/i686/cmov/libpthread.so.0
No symbol table info available.
#2  0x08214dac in amaroK::Crash::crashHandler ()
No symbol table info available.
#3  <signal handler called>
No symbol table info available.
#4  0xb6a963cf in QListViewItem::takeItem () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#5  0xb6a96973 in QListViewItem::~QListViewItem () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#6  0xb7ae44dd in KListViewItem::~KListViewItem () from /usr/lib/libkdeui.so.4
No symbol table info available.
#7  0x08192b94 in QMapPrivate<QString, KURL>::QMapPrivate ()
No symbol table info available.
#8  0x08197426 in QMapPrivate<QString, QPixmap>::QMapPrivate ()
No symbol table info available.
#9  0xb692edfa in QApplication::sendPostedEvents () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#10 0xb692eed9 in QApplication::sendPostedEvents () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#11 0xb68d08ae in QEventLoop::processEvents () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#12 0xb6945ea2 in QEventLoop::enterLoop () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#13 0xb6945dcb in QEventLoop::exec () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#14 0xb692c305 in QApplication::exec () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#15 0x081f628d in QWizard::setFinish ()
No symbol table info available.
#16 0xb6ee5eb0 in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6
No symbol table info available.
#17 0x080893c1 in ?? ()
No symbol table info available.
==== (gdb) thread apply all bt ====
Thread 7 (Thread -1253606480 (LWP 19857)):
#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb7322fec in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/libpthread.so.0
#2  0xb4abda23 in xine_open () from /usr/lib/libxine.so.1
Thread 6 (Thread -1269458000 (LWP 19858)):
#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb6f98323 in poll () from /lib/tls/i686/cmov/libc.so.6
#2  0xb455f788 in ?? () from /usr/lib/xine/plugins/1.0.1/xineplug_ao_out_alsa.so
#3  0xb4559390 in ?? ()
#4  0x00000001 in ?? ()
#5  0x0000014d in ?? ()
#6  0x00000000 in ?? ()
#7  0x0867b370 in ?? ()
#8  0x00000000 in ?? ()
#9  0x00000000 in ?? ()
#10 0x00000013 in ?? ()
#11 0x00000029 in ?? ()
#12 0x00000000 in ?? ()
#13 0x00000000 in ?? ()
#14 0x00000000 in ?? ()
#15 0x00000000 in ?? ()
#16 0x00000000 in ?? ()
#17 0x00000000 in ?? ()
#18 0x00000000 in ?? ()
#19 0x00000000 in ?? ()
#20 0x00000000 in ?? ()
#21 0x00000000 in ?? ()
#22 0x00000000 in ?? ()
#23 0x00000000 in ?? ()
#24 0x00000000 in ?? ()
#25 0x00000000 in ?? ()
#26 0x00000000 in ?? ()
#27 0x00000000 in ?? ()
#28 0x00000000 in ?? ()
#29 0x00000000 in ?? ()
#30 0x00000000 in ?? ()
#31 0x00000000 in ?? ()
#32 0x00000000 in ?? ()
#33 0x00000000 in ?? ()
#34 0x00000000 in ?? ()
#35 0x00000000 in ?? ()
#36 0x00000000 in ?? ()
#37 0x00000000 in ?? ()
#38 0x00000000 in ?? ()
#39 0x00000000 in ?? ()
#40 0x00000000 in ?? ()
#41 0x00000000 in ?? ()
#42 0x00000000 in ?? ()
#43 0x00000000 in ?? ()
#44 0x00000000 in ?? ()
#45 0x00000050 in ?? ()
#46 0x00000050 in ?? ()
#47 0x00000000 in ?? ()
#48 0x00000000 in ?? ()
#49 0xb732aff4 in ?? () from /lib/tls/i686/cmov/libpthread.so.0
#50 0x00000000 in ?? ()
#51 0x007d0f00 in ?? ()
#52 0xb45594a8 in ?? ()
#53 0xb7320e70 in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#0  0xffffe410 in __kernel_vsyscall ()


==== kdBacktrace() ================
Comment 1 Mark Kretschmann 2005-11-09 17:11:43 UTC
Note: Reporter adds, crash is not induced when using drag&drop instead.
Comment 2 Mark Kretschmann 2005-11-09 17:16:00 UTC
Note: Reporter adds, system is a p-d 3ghz (dualcore) .. highmem4 w/ 1.5gb ram. 

I'm suspecting a race condition.
Comment 3 Rodney Gordon II 2005-11-10 03:52:15 UTC
I just got it to do it in the Collection view also.. Same thing -> right click then "Load"..

======== DEBUG INFORMATION  =======
Engine:     xine-engine
Build date: Nov  8 2005
CC version: 4.0.3 20051023 (prerelease) (Debian 4.0.2-3)
KDElibs:    3.4.2
TagLib:     1.4.0
NDEBUG:     true
==== file /usr/lib/amarok/amarokapp =======
/usr/lib/amarok/amarokapp: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.0, dynamically linked (uses shared libs), stripped


==== (gdb) bt =====================
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
`system-supplied DSO at 0xffffe000' has disappeared; keeping its symbols.
[Thread debugging using libthread_db enabled]
[New Thread -1251539232 (LWP 7131)]
[New Thread -1305936976 (LWP 11533)]
[New Thread -1296266320 (LWP 7140)]
[New Thread -1287873616 (LWP 7139)]
[New Thread -1277592656 (LWP 7138)]
[New Thread -1268929616 (LWP 7137)]
[New Thread -1254134864 (LWP 7136)]
0xffffe410 in __kernel_vsyscall ()
#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb72a974b in __waitpid_nocancel () from /lib/tls/i686/cmov/libpthread.so.0
#2  0x08214dac in amaroK::Crash::crashHandler ()
#3  <signal handler called>
#4  0xb6a193cf in QListViewItem::takeItem () from /usr/lib/libqt-mt.so.3
#5  0xb6a19973 in QListViewItem::~QListViewItem () from /usr/lib/libqt-mt.so.3
#6  0xb7a674dd in KListViewItem::~KListViewItem () from /usr/lib/libkdeui.so.4
#7  0x08192b94 in QMapPrivate<QString, KURL>::QMapPrivate ()
#8  0x08197426 in QMapPrivate<QString, QPixmap>::QMapPrivate ()
#9  0xb68b1dfa in QApplication::sendPostedEvents () from /usr/lib/libqt-mt.so.3
#10 0xb68b1ed9 in QApplication::sendPostedEvents () from /usr/lib/libqt-mt.so.3
#11 0xb68538ae in QEventLoop::processEvents () from /usr/lib/libqt-mt.so.3
#12 0xb68c8ea2 in QEventLoop::enterLoop () from /usr/lib/libqt-mt.so.3
#13 0xb68c8dcb in QEventLoop::exec () from /usr/lib/libqt-mt.so.3
#14 0xb68af305 in QApplication::exec () from /usr/lib/libqt-mt.so.3
#15 0x081f628d in QWizard::setFinish ()
#16 0xb6e68eb0 in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6
#17 0x080893c1 in ?? ()
#0  0xffffe410 in __kernel_vsyscall ()
No symbol table info available.
#1  0xb72a974b in __waitpid_nocancel () from /lib/tls/i686/cmov/libpthread.so.0
No symbol table info available.
#2  0x08214dac in amaroK::Crash::crashHandler ()
No symbol table info available.
#3  <signal handler called>
No symbol table info available.
#4  0xb6a193cf in QListViewItem::takeItem () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#5  0xb6a19973 in QListViewItem::~QListViewItem () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#6  0xb7a674dd in KListViewItem::~KListViewItem () from /usr/lib/libkdeui.so.4
No symbol table info available.
#7  0x08192b94 in QMapPrivate<QString, KURL>::QMapPrivate ()
No symbol table info available.
#8  0x08197426 in QMapPrivate<QString, QPixmap>::QMapPrivate ()
No symbol table info available.
#9  0xb68b1dfa in QApplication::sendPostedEvents () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#10 0xb68b1ed9 in QApplication::sendPostedEvents () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#11 0xb68538ae in QEventLoop::processEvents () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#12 0xb68c8ea2 in QEventLoop::enterLoop () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#13 0xb68c8dcb in QEventLoop::exec () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#14 0xb68af305 in QApplication::exec () from /usr/lib/libqt-mt.so.3
No symbol table info available.
#15 0x081f628d in QWizard::setFinish ()
No symbol table info available.
#16 0xb6e68eb0 in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6
No symbol table info available.
#17 0x080893c1 in ?? ()
No symbol table info available.
==== (gdb) thread apply all bt ====
Thread 7 (Thread -1254134864 (LWP 7136)):
#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb72a5fec in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/libpthread.so.0
#2  0xb4b71a23 in xine_open () from /usr/lib/libxine.so.1
Thread 6 (Thread -1268929616 (LWP 7137)):
#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb6f1b323 in poll () from /lib/tls/i686/cmov/libc.so.6
#2  0xb45e0788 in ?? () from /usr/lib/xine/plugins/1.0.1/xineplug_ao_out_alsa.so
#3  0xb45da390 in ?? ()
#4  0x00000001 in ?? ()
#5  0x0000014d in ?? ()
#6  0x00000000 in ?? ()
#7  0x08371440 in ?? ()
#8  0x00000000 in ?? ()
#9  0x00000000 in ?? ()
#10 0x00000013 in ?? ()
#11 0x00000029 in ?? ()
#12 0x00000000 in ?? ()
#13 0x00000000 in ?? ()
#14 0x00000000 in ?? ()
#15 0x00000000 in ?? ()
#16 0x00000000 in ?? ()
#17 0x00000000 in ?? ()
#18 0x00000000 in ?? ()
#19 0x00000000 in ?? ()
#20 0x00000000 in ?? ()
#21 0x00000000 in ?? ()
#22 0x00000000 in ?? ()
#23 0x00000000 in ?? ()
#24 0x00000000 in ?? ()
#25 0x00000000 in ?? ()
#26 0x00000000 in ?? ()
#27 0x00000000 in ?? ()
#28 0x00000000 in ?? ()
#29 0x00000000 in ?? ()
#30 0x00000000 in ?? ()
#31 0x00000000 in ?? ()
#32 0x00000000 in ?? ()
#33 0x00000000 in ?? ()
#34 0x00000000 in ?? ()
#35 0x00000000 in ?? ()
#36 0x00000000 in ?? ()
#37 0x00000000 in ?? ()
#38 0x00000000 in ?? ()
#39 0x00000000 in ?? ()
#40 0x00000000 in ?? ()
#41 0x00000000 in ?? ()
#42 0x00000000 in ?? ()
#43 0x00000000 in ?? ()
#44 0x00000000 in ?? ()
#45 0x00000050 in ?? ()
#46 0x00000050 in ?? ()
#47 0x00000000 in ?? ()
#48 0x00000000 in ?? ()
#49 0xb72adff4 in ?? () from /lib/tls/i686/cmov/libpthread.so.0
#50 0x00000000 in ?? ()
#51 0x007d0f00 in ?? ()
#52 0xb45da4a8 in ?? ()
#53 0xb72a3e70 in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#0  0xffffe410 in __kernel_vsyscall ()


==== kdBacktrace() ================
Comment 4 Seb Ruiz 2005-11-10 03:59:19 UTC
Markey, as i suspected, its a threading problem with takeItem() crashes.

On Thursday 10 November 2005 13:52, Rodney Gordon II wrote:
[bugs.kde.org quoted mail]
Comment 5 Mark Kretschmann 2005-11-11 12:05:08 UTC
Good news! Or maybe not so good. It's a Qt bug, see here:
http://lists.kde.org/?l=kde-devel&m=113113845120155&w=2

Now the question is if we can find a workaround.
Comment 6 Seb Ruiz 2005-11-11 14:10:32 UTC
SVN commit 479696 by seb:

Overcome regression in qt 3.3.5, caused by QListView::clear().  Delete all items individually.
See http://lists.kde.org/?l=kde-devel&m=113113845120155&w=2
BUG:116004


 M  +26 -3     playlist.cpp  
 M  +2 -1      playlist.h  


--- trunk/extragear/multimedia/amarok/src/playlist.cpp #479695:479696
@@ -387,7 +387,7 @@
         m_undoDir.remove( *it );
 
     //speed up quit a little
-    KListView::clear();   //our implementation is slow
+    safeClear();   //our implementation is slow
     delete m_tooltip;
     blockSignals( true ); //might help
 }
@@ -1621,10 +1621,33 @@
     // something to bear in mind, if there is any event in the loop
     // that depends on a PlaylistItem, we are about to crash amaroK
     // never unlock() the Playlist until it is safe!
-    KListView::clear();
+    safeClear();
 }
 
+/*!
+ * Fix qt bug in QListView::clear()
+ * @see http://lists.kde.org/?l=kde-devel&m=113113845120155&w=2
+ */
+
 void
+Playlist::safeClear()
+{
+    bool block = signalsBlocked();
+    blockSignals( true );
+    clearSelection();
+
+    QListViewItem *c = firstChild();
+    QListViewItem *n;
+    while( c ) {
+        n = c->nextSibling();
+        delete c;
+        c = n;
+    }
+    blockSignals( block );
+    triggerUpdate();
+}
+
+void
 Playlist::setSorting( int col, bool b )
 {
     saveUndoState();
@@ -3633,7 +3656,7 @@
     m_nextTracks.clear();
     emit queueChanged( PLItemList(), prev );
     ThreadWeaver::instance()->abortAllJobsNamed( "TagWriter" );
-    KListView::clear();
+    safeClear();
 
     insertMediaInternal( url, 0 ); //because the listview is empty, undoState won't be forced
 
--- trunk/extragear/multimedia/amarok/src/playlist.h #479695:479696
@@ -160,6 +160,7 @@
         void copyToClipboard( const QListViewItem* = 0 ) const;
         void countChanged( const QString &path );
         void deleteSelectedFiles();
+        void ensureItemCentered( QListViewItem* item );
         void playCurrentTrack();
         void playNextTrack( const bool forceNext = true );
         void playPrevTrack();
@@ -168,6 +169,7 @@
         void removeDuplicates();
         void removeSelectedItems();
         void repopulate();
+        void safeClear();
         void scoreChanged( const QString &path, int score );
         void selectAll() { QListView::selectAll( true ); }
         void setFilter( const QString &filter );                           //for the entire playlist
@@ -175,7 +177,6 @@
         void setFilterSlot( const QString &filter );                       //uses a delay where applicable
         void setStopAfterCurrent( bool on );
         void setStopAfterMode( int mode );
-        void ensureItemCentered( QListViewItem* item );
         void showCurrentTrack() { ensureItemCentered( m_currentTrack ); }
         void showQueueManager();
         void shuffle();
Comment 7 Seb Ruiz 2005-11-12 04:26:00 UTC
SVN commit 479882 by seb:

backport fix for bug 116004
CCBUG: 116004


 M  +5 -0      ChangeLog  
 M  +24 -2     src/playlist.cpp  
 M  +2 -1      src/playlist.h  


--- branches/stable/extragear/multimedia/amarok/ChangeLog #479881:479882
@@ -5,6 +5,11 @@
 
 VERSION 1.3.7:
   BUGFIXES:
+    * Fix for regression in Qt 3.3.5, causing amaroK to crash when clearing 
+      the playlist. (BR 116004)
+    * Fix possible bug when saving unencoded podcasts to strange file systems.
+    * Zombie directories are removed automatically from the collection
+      scanner. (BR 115779)
     * Dates wouldn't be properly loaded when editing Smart Playlists.
     * Number of songs to add when using dynamic mode wouldn't be respected,
       if the smartplaylist didn't have a ORDER BY statement. (BR 115860)
--- branches/stable/extragear/multimedia/amarok/src/playlist.cpp #479881:479882
@@ -337,7 +337,7 @@
         m_undoDir.remove( *it );
 
     //speed up quit a little
-    KListView::clear();   //our implementation is slow
+    safeClear();   //our implementation is slow
     blockSignals( true ); //might help
 }
 
@@ -1570,10 +1570,32 @@
     // something to bear in mind, if there is any event in the loop
     // that depends on a PlaylistItem, we are about to crash amaroK
     // never unlock() the Playlist until it is safe!
-    KListView::clear();
+    safeClear();
 }
 
+/*!
+ * Fix qt bug in QListView::clear()
+ * @see http://lists.kde.org/?l=kde-devel&m=113113845120155&w=2 
+ */
+
 void
+Playlist::safeClear()
+{
+    bool block = signalsBlocked();
+    blockSignals( true );
+    clearSelection();
+
+    QListViewItem *c = firstChild();
+    QListViewItem *n;
+    while( c ) {
+        n = c->nextSibling();
+        c = n;
+    }
+    blockSignals( block );
+    triggerUpdate();
+}
+
+void
 Playlist::setSorting( int col, bool b )
 {
     saveUndoState();
--- branches/stable/extragear/multimedia/amarok/src/playlist.h #479881:479882
@@ -153,6 +153,7 @@
         void copyToClipboard( const QListViewItem* = 0 ) const;
         void countChanged( const QString &path );
         void deleteSelectedFiles();
+        void ensureItemCentered( QListViewItem* item );
         void playCurrentTrack();
         void playNextTrack( const bool forceNext = true );
         void playPrevTrack();
@@ -161,6 +162,7 @@
         void removeDuplicates();
         void removeSelectedItems();
         void repopulate();
+        void safeClear();
         void scoreChanged( const QString &path, int score );
         void selectAll() { QListView::selectAll( true ); }
         void setFilter( const QString &filter );                           //for the entire playlist
@@ -168,7 +170,6 @@
         void setFilterSlot( const QString &filter );                       //uses a delay where applicable
         void setStopAfterCurrent( bool on );
         void setStopAfterMode( int mode );
-        void ensureItemCentered( QListViewItem* item );
         void showCurrentTrack() { ensureItemCentered( m_currentTrack ); }
         void showQueueManager();
         void shuffle();