Bug 136353

Summary: Crash when closing amarok directly after startup
Product: [Applications] amarok Reporter: Sven Krohlas <sven>
Component: PlaylistAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:

Description Sven Krohlas 2006-10-26 20:19:43 UTC
Version:           1.4.4 SVN (using KDE KDE 3.5.5)
Installed from:    SuSE RPMs
Compiler:          gcc version 4.0.2 20050901 (prerelease) (SUSE Linux) 
OS:                Linux

Steps to reproduce:
1.) Start Amarok
2.) Close Amarok while it is still loading the playlist -> crash

BT: http://amarok.pastebin.ca/222426

This is also a dataloss bug: the playlist is cut to only a few songs after reproducing the problem a few times.
Comment 1 Sven Krohlas 2006-10-26 20:41:58 UTC
The backtrace, saved from pastebin:

======== DEBUG INFORMATION  =======
Version:    1.4-SVN-0610260935
Engine:     xine-engine
Build date: Oct 26 2006
CC version: 4.0.2 20050901 (prerelease) (SUSE Linux)
KDElibs:    3.5.5 "release 19.1" 
Qt:         3.3.6
TagLib:     1.4.0
CPU count:  1

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


==== (gdb) bt =====================
Using host libthread_db library "/lib/tls/libthread_db.so.1".
`system-supplied DSO at 0xffffe000' has disappeared; keeping its symbols.
[Thread debugging using libthread_db enabled]
[New Thread 1108656128 (LWP 2574)]
[New Thread 1136765872 (LWP 2586)]
[Thread debugging using libthread_db enabled]
[New Thread 1108656128 (LWP 2574)]
[New Thread 1136765872 (LWP 2586)]
[Thread debugging using libthread_db enabled]
[New Thread 1108656128 (LWP 2574)]
[New Thread 1136765872 (LWP 2586)]
[New Thread 1134664624 (LWP 2585)]
[New Thread 1130675120 (LWP 2584)]
[New Thread 1128266672 (LWP 2583)]
0xffffe410 in __kernel_vsyscall ()
#0  0xffffe410 in __kernel_vsyscall ()
#1  0x41ff842b in __waitpid_nocancel () from /lib/tls/libpthread.so.0
#2  0x0804dd10 in Amarok::Crash::crashHandler () at /home/sven/amarok-svn/amarok/src/amarokcore/crashhandler.cpp:249
#3  <signal handler called>
#4  0x00000000 in ?? ()
#5  0x40381b38 in ~UrlLoader (this=0x835b200) at /home/sven/amarok-svn/amarok/src/playlistloader.cpp:174
#6  0x416f1b3d in QApplication::removePostedEvents () from /usr/lib/qt3/lib/libqt-mt.so.3
#7  0x416f1ba3 in QApplication::removePostedEvents () from /usr/lib/qt3/lib/libqt-mt.so.3
#8  0x41753ea1 in QObject::~QObject () from /usr/lib/qt3/lib/libqt-mt.so.3
#9  0x403f213f in ~ThreadWeaver (this=0x82c57d0) at /home/sven/amarok-svn/amarok/src/threadweaver.cpp:55
#10 0x401cc9af in ThreadWeaver::deleteInstance () at threadweaver.h:413
#11 0x401c73eb in ~App (this=0xbfe4617c) at /home/sven/amarok-svn/amarok/src/app.cpp:152
#12 0x0804cde8 in main (argc=1, argv=0xbfe462e4) at /home/sven/amarok-svn/amarok/src/main.cpp:109
#0  0xffffe410 in __kernel_vsyscall ()
No symbol table info available.
#1  0x41ff842b in __waitpid_nocancel () from /lib/tls/libpthread.so.0
No symbol table info available.
#2  0x0804dd10 in Amarok::Crash::crashHandler () at /home/sven/amarok-svn/amarok/src/amarokcore/crashhandler.cpp:249
	pid = 2602
#3  <signal handler called>
No symbol table info available.
#4  0x00000000 in ?? ()
No symbol table info available.
#5  0x40381b38 in ~UrlLoader (this=0x835b200) at /home/sven/amarok-svn/amarok/src/playlistloader.cpp:174
No locals.
#6  0x416f1b3d in QApplication::removePostedEvents () from /usr/lib/qt3/lib/libqt-mt.so.3
No symbol table info available.
#7  0x416f1ba3 in QApplication::removePostedEvents () from /usr/lib/qt3/lib/libqt-mt.so.3
No symbol table info available.
#8  0x41753ea1 in QObject::~QObject () from /usr/lib/qt3/lib/libqt-mt.so.3
No symbol table info available.
#9  0x403f213f in ~ThreadWeaver (this=0x82c57d0) at /home/sven/amarok-svn/amarok/src/threadweaver.cpp:55
No locals.
#10 0x401cc9af in ThreadWeaver::deleteInstance () at threadweaver.h:413
No locals.
#11 0x401c73eb in ~App (this=0xbfe4617c) at /home/sven/amarok-svn/amarok/src/app.cpp:152
	uniquelyNamedStackAllocatedStandardBlock = {m_start = {tv_sec = 1161852006, tv_usec = 456504}, m_label = 0x404cdd78 "virtual App::~App()"}
	engine = (EngineBase * const) 0x8397f60
#12 0x0804cde8 in main (argc=1, argv=0xbfe462e4) at /home/sven/amarok-svn/amarok/src/main.cpp:109
	app = {<> = {<No data fields>}, <EngineObserver> = {_vptr.EngineObserver = 0x40528d88, m_subject = 0x0}, static metaObj = 0x8134ce8, 
  static mainThreadId = 0, m_pGlobalAccel = 0x816af30, m_pPlayerWindow = 0x0, m_pPlaylistWindow = 0x8169f20, m_pTray = 0x814ada0, 
  m_pMediaDeviceManager = 0x40544980}
==== (gdb) thread apply all bt ====
Thread 5 (Thread 1128266672 (LWP 2583)):
#0  0xffffe410 in __kernel_vsyscall ()
#1  0x41ff4cec in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
#2  0x42cfa9e3 in metronom_sync_loop (this=0x83fadf0) at metronom.c:873
#3  0x41ff2297 in start_thread () from /lib/tls/libpthread.so.0
#4  0x420e337e in clone () from /lib/tls/libc.so.6
#5  0x433ffbb0 in ?? ()
Thread 4 (Thread 1130675120 (LWP 2584)):
#0  0xffffe410 in __kernel_vsyscall ()
#1  0x41ff4a76 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
#2  0x42d08eba in fifo_remove_int (fifo=0x84131d8, blocking=1) at audio_out.c:342
#3  0x42d0cc41 in ao_loop (this_gen=0x8412668) at audio_out.c:380
#4  0x41ff2297 in start_thread () from /lib/tls/libpthread.so.0
#5  0x420e337e in clone () from /lib/tls/libc.so.6
#6  0x4364bbb0 in ?? ()
Thread 3 (Thread 1134664624 (LWP 2585)):
#0  0xffffe410 in __kernel_vsyscall ()
#1  0x41ff4a76 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
#2  0x42cfd8fc in fifo_buffer_get (fifo=0x8593c10) at buffer.c:233
#3  0x42d04c71 in audio_decoder_loop (stream_gen=0x8587f80) at audio_decoder.c:68
#4  0x41ff2297 in start_thread () from /lib/tls/libpthread.so.0
#5  0x420e337e in clone () from /lib/tls/libc.so.6
#6  0x43a19bb0 in ?? ()
Thread 2 (Thread 1136765872 (LWP 2586)):
#0  0xffffe410 in __kernel_vsyscall ()
#1  0x41ff4a76 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
#2  0x42d0e094 in xine_event_wait (queue=0x859bef0) at events.c:59
#3  0x42d0e44c in listener_loop (queue_gen=0x859bef0) at events.c:216
#4  0x41ff2297 in start_thread () from /lib/tls/libpthread.so.0
#5  0x420e337e in clone () from /lib/tls/libc.so.6
#6  0x43c1abb0 in ?? ()
Thread 1 (Thread 1108656128 (LWP 2574)):
#0  0xffffe410 in __kernel_vsyscall ()
#1  0x41ff842b in __waitpid_nocancel () from /lib/tls/libpthread.so.0
#2  0x0804dd10 in Amarok::Crash::crashHandler () at /home/sven/amarok-svn/amarok/src/amarokcore/crashhandler.cpp:249
#3  <signal handler called>
#4  0x00000000 in ?? ()
#5  0x40381b38 in ~UrlLoader (this=0x835b200) at /home/sven/amarok-svn/amarok/src/playlistloader.cpp:174
#6  0x416f1b3d in QApplication::removePostedEvents () from /usr/lib/qt3/lib/libqt-mt.so.3
#7  0x416f1ba3 in QApplication::removePostedEvents () from /usr/lib/qt3/lib/libqt-mt.so.3
#8  0x41753ea1 in QObject::~QObject () from /usr/lib/qt3/lib/libqt-mt.so.3
#9  0x403f213f in ~ThreadWeaver (this=0x82c57d0) at /home/sven/amarok-svn/amarok/src/threadweaver.cpp:55
#10 0x401cc9af in ThreadWeaver::deleteInstance () at threadweaver.h:413
#11 0x401c73eb in ~App (this=0xbfe4617c) at /home/sven/amarok-svn/amarok/src/app.cpp:152
#12 0x0804cde8 in main (argc=1, argv=0xbfe462e4) at /home/sven/amarok-svn/amarok/src/main.cpp:109
#0  0xffffe410 in __kernel_vsyscall ()


==== kdBacktrace() ================
[
0: /opt/kde3/lib/libkdecore.so.4(_Z11kdBacktracei+0x45) [0x412d7e55]
1: /opt/kde3/lib/libkdecore.so.4(_Z11kdBacktracev+0x2b) [0x412d81db]
2: amarokapp(_ZN6Amarok5Crash12crashHandlerEi+0xc7b) [0x804db59]
3: [0xffffe420]
4: /usr/lib/qt3/lib/libqt-mt.so.3(_ZN12QApplication18removePostedEventsEP7QObjecti+0xcd) [0x416f1b3d]
5: /usr/lib/qt3/lib/libqt-mt.so.3(_ZN12QApplication18removePostedEventsEP7QObject+0x23) [0x416f1ba3]
6: /usr/lib/qt3/lib/libqt-mt.so.3(_ZN7QObjectD2Ev+0x91) [0x41753ea1]
7: /opt/kde3/lib/libamarok.so.0(_ZN12ThreadWeaverD0Ev+0x2f9) [0x403f213f]
8: /opt/kde3/lib/libamarok.so.0(_ZN12ThreadWeaver14deleteInstanceEv+0x33) [0x401cc9af]
9: /opt/kde3/lib/libamarok.so.0(_ZN3AppD1Ev+0x257) [0x401c73eb]
10: amarokapp [0x804cde8]
11: /lib/tls/libc.so.6(__libc_start_main+0xd0) [0x42039ea0]
12: amarokapp(_ZN6QGList5clearEv+0xc9) [0x804c671]
]
Comment 2 Scott Ortell 2006-10-29 02:48:24 UTC
I was able to reproduce this also in 1.4.3

Heres the first 15 in the backtrace:

======== DEBUG INFORMATION  =======
Version:    1.4.3
Engine:     xine-engine
Build date: Oct 15 2006
CC version: 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)
KDElibs:    3.5.5
Qt:         3.3.6
TagLib:     1.4.0
CPU count:  1
NDEBUG:     true
==== file /usr/lib/amarok/amarokapp =======
/usr/lib/amarok/amarokapp: symbolic link to `/usr/bin/amarokapp'


==== (gdb) bt =====================
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread -1249580560 (LWP 7404)]
[New Thread -1301603424 (LWP 7416)]
[New Thread -1293210720 (LWP 7415)]
[New Thread -1253274720 (LWP 7414)]
[New Thread -1282622560 (LWP 7411)]
0xffffe410 in __kernel_vsyscall ()
#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb6caf34b in __waitpid_nocancel ()
   from /lib/tls/i686/cmov/libpthread.so.0
#2  0x0804d161 in amaroK::Crash::crashHandler ()
#3  <signal handler called>
#4  0xb7cb308e in Playlist::unlock () from /usr/lib/libamarok.so.0
#5  0xb7d27388 in UrlLoader::~UrlLoader () from /usr/lib/libamarok.so.0
#6  0xb62db89a in QApplication::removePostedEvents ()
   from /usr/lib/libqt-mt.so.3
#7  0xb62db95d in QApplication::removePostedEvents ()
   from /usr/lib/libqt-mt.so.3
#8  0xb6347580 in QObject::~QObject () from /usr/lib/libqt-mt.so.3
#9  0xb7d9b8f2 in ThreadWeaver::~ThreadWeaver () from /usr/lib/libamarok.so.0
#10 0xb7b22211 in App::~App () from /usr/lib/libamarok.so.0
#11 0x0804bcc7 in ?? ()
#12 0xbfc9ce5c in ?? ()
#13 0xbfc9cff4 in ?? ()
#14 0x00000013 in ?? ()
#15 0x08067ac8 in _IO_stdin_used ()
#16 0x00000000 in ?? ()
#0  0xffffe410 in __kernel_vsyscall ()
No symbol table info available.
Comment 3 Martin Aumueller 2006-12-28 21:46:10 UTC
SVN commit 617346 by aumuell:

don't crash when quitting while still loading the saved playlist
BUG: 136353


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


--- trunk/extragear/multimedia/amarok/ChangeLog #617345:617346
@@ -87,6 +87,8 @@
     * Amarok now saves playlists with relative paths by default.
 
   BUGFIXES:
+    * Don't crash when quitting while initially loading the playlist.
+      (BR 136353)
     * The same track could be queued multiple times for transferring to a
       media device. (BR 129136)
     * Migrate statistics for files moved from outside to the collection.
--- trunk/extragear/multimedia/amarok/src/playlist.cpp #617345:617346
@@ -175,6 +175,9 @@
         , m_visLength( 0 )
         , m_total( 0 )
         , m_itemCountDirty( false )
+        , m_undoButton( 0 )
+        , m_redoButton( 0 )
+        , m_clearButton( 0 )
         , m_undoDir( Amarok::saveLocation( "undo/" ) )
         , m_undoCounter( 0 )
         , m_dynamicMode( 0 )
@@ -401,12 +404,13 @@
 {
     saveLayout( KGlobal::config(), "PlaylistColumnsLayout" );
 
-    if( AmarokConfig::savePlaylist() ) saveXML( defaultPlaylistPath() );
+    if( AmarokConfig::savePlaylist() && m_lockStack == 0 ) saveXML( defaultPlaylistPath() );
 
     //speed up quit a little
     safeClear();   //our implementation is slow
     Amarok::ToolTip::remove( viewport() );
     blockSignals( true ); //might help
+    s_instance = 0;
 }
 
 
--- trunk/extragear/multimedia/amarok/src/playlistloader.cpp #617345:617346
@@ -172,9 +172,12 @@
 
 UrlLoader::~UrlLoader()
 {
-    Playlist::instance()->unlock();
+    if( Playlist::instance() )
+    {
+        Playlist::instance()->unlock();
+        delete m_markerListViewItem;
+    }
 
-    delete m_markerListViewItem;
     delete m_xmlSource;
 }