Bug 262307 - Amarok crashes on startup when no config files are present [@ Playlist::Actions::restoreDefaultPlaylist]
Summary: Amarok crashes on startup when no config files are present [@ Playlist::Actio...
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: Playlist (show other bugs)
Version: 2.4-GIT
Platform: Compiled Sources Linux
: VHI crash
Target Milestone: 2.4.0
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-06 15:08 UTC by Philipp Schmidt
Modified: 2011-01-07 11:16 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 2.4
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Schmidt 2011-01-06 15:08:38 UTC
Application: amarok (2.4-GIT)
KDE Platform Version: 4.5.4 (KDE 4.5.4) (Compiled from sources)
Qt Version: 4.7.1
Operating System: Linux 2.6.36-ARCH i686
Distribution (Platform): Archlinux Packages

-- Information about the crash:
- What I was doing when the application crashed:
I removed all my configs and tried to start amarok with a clean config: Crash
Started amarok with new user (also no config files present): same Crash

- Version used: GIT compiled yesterday

The crash can be reproduced every time.

-- Backtrace:
Application: Amarok (amarok), signal: Aborted
[Current thread is 1 (Thread 0xafea2720 (LWP 7395))]

Thread 6 (Thread 0xa8fa0b70 (LWP 7399)):
#0  0xb77f8424 in __kernel_vsyscall ()
#1  0xb56ca6b3 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0xb5a47744 in pthread_cond_timedwait () from /lib/libc.so.6
#3  0xad7b1b55 in ?? () from /usr/lib/libxine.so.1
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Thread 5 (Thread 0xa97a1b70 (LWP 7400)):
#0  0xb3b6dd76 in clock_gettime () from /lib/librt.so.1
#1  0xb5c75c18 in ?? () from /usr/lib/libQtCore.so.4
#2  0xb5d42af2 in ?? () from /usr/lib/libQtCore.so.4
#3  0xb5d41342 in ?? () from /usr/lib/libQtCore.so.4
#4  0xb5d413dd in ?? () from /usr/lib/libQtCore.so.4
#5  0xb3d2e096 in g_main_context_prepare () from /usr/lib/libglib-2.0.so.0
#6  0xb3d2ef33 in ?? () from /usr/lib/libglib-2.0.so.0
#7  0xb3d2f604 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#8  0xb5d41b87 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#9  0xb5d13769 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#10 0xb5d13a0a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#11 0xb5c1cb6b in QThread::exec() () from /usr/lib/libQtCore.so.4
#12 0xad7fd689 in ?? () from /usr/lib/kde4/plugins/phonon_backend/phonon_xine.so
#13 0xb5c1f5f9 in ?? () from /usr/lib/libQtCore.so.4
#14 0xb56c5dd0 in start_thread () from /lib/libpthread.so.0
#15 0xb5a39d2e in clone () from /lib/libc.so.6

Thread 4 (Thread 0xad57ab70 (LWP 7403)):
#0  0xb77f8424 in __kernel_vsyscall ()
#1  0xb56ca30b in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0xb5a476ed in pthread_cond_wait () from /lib/libc.so.6
#3  0xad7c4a24 in ?? () from /usr/lib/libxine.so.1
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Thread 3 (Thread 0xacd79b70 (LWP 7404)):
#0  0xb77f8424 in __kernel_vsyscall ()
#1  0xb56ca30b in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0xb5a476ed in pthread_cond_wait () from /lib/libc.so.6
#3  0xad7c4a24 in ?? () from /usr/lib/libxine.so.1
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Thread 2 (Thread 0xac3ffb70 (LWP 7405)):
#0  0xb77f8424 in __kernel_vsyscall ()
#1  0xb56ca30b in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0xb5a476ed in pthread_cond_wait () from /lib/libc.so.6
#3  0xad7c4a24 in ?? () from /usr/lib/libxine.so.1
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Thread 1 (Thread 0xafea2720 (LWP 7395)):
[KCrash Handler]
#7  0xb77f8424 in __kernel_vsyscall ()
#8  0xb5995c91 in raise () from /lib/libc.so.6
#9  0xb599751e in abort () from /lib/libc.so.6
#10 0xb5c17042 in qt_message_output(QtMsgType, char const*) () from /usr/lib/libQtCore.so.4
#11 0xb5c171e7 in ?? () from /usr/lib/libQtCore.so.4
#12 0xb5c172f9 in qFatal(char const*, ...) () from /usr/lib/libQtCore.so.4
#13 0xb5c17385 in qt_assert(char const*, char const*, int) () from /usr/lib/libQtCore.so.4
#14 0xb6cc3787 in KSharedPtr<Playlists::PlaylistFile>::operator-> (this=0xbff9010c) at /usr/include/KDE/../ksharedptr.h:126
#15 0xb6cc069b in Playlist::Actions::restoreDefaultPlaylist (this=0xa659718) at /home/philipp/Entwicklung/aur/amarok-git/src/amarok/src/playlist/PlaylistActions.cpp:469
#16 0xb6cbf072 in Playlist::Actions::init (this=0xa659718) at /home/philipp/Entwicklung/aur/amarok-git/src/amarok/src/playlist/PlaylistActions.cpp:93
#17 0xb6cbee48 in Playlist::Actions::instance () at /home/philipp/Entwicklung/aur/amarok-git/src/amarok/src/playlist/PlaylistActions.cpp:58
#18 0xb6cc0d2e in The::playlistActions () at /home/philipp/Entwicklung/aur/amarok-git/src/amarok/src/playlist/PlaylistActions.cpp:519
#19 0xb6fd6f8e in MainWindow::createActions (this=0x9ea0378) at /home/philipp/Entwicklung/aur/amarok-git/src/amarok/src/MainWindow.cpp:718
#20 0xb6fd313f in MainWindow::MainWindow (this=0x9ea0378) at /home/philipp/Entwicklung/aur/amarok-git/src/amarok/src/MainWindow.cpp:158
#21 0xb6fb85a0 in App::continueInit (this=0xbff909c0) at /home/philipp/Entwicklung/aur/amarok-git/src/amarok/src/App.cpp:619
#22 0xb6fb5bbc in App::App (this=0xbff909c0) at /home/philipp/Entwicklung/aur/amarok-git/src/amarok/src/App.cpp:209
#23 0x08050627 in main (argc=2, argv=0xbff91394) at /home/philipp/Entwicklung/aur/amarok-git/src/amarok/src/main.cpp:266

Reported using DrKonqi
Comment 1 Thierry Göckel 2011-01-06 15:22:11 UTC
I can confirm this bug occurring when there are no /config/amarok* files AND no /apps/amarok directory installed.

backtrace: http://pastebin.com/zwygLNfQ
and --debug mentions:
amarok:           [ERROR__] "Could not load local playlist file /home/thierry/.kde/share/apps/amarok/current.xspf!"
Comment 2 Myriam Schweingruber 2011-01-06 19:18:45 UTC
This is probably due to Amatrok expecting an existing current.xspf file, this file is normally in $HOME/.kde/apps/amarok/ . Very weird bug IMHO.
Comment 3 Mark Kretschmann 2011-01-07 11:08:27 UTC
commit c3846167e23b17c6ea12b77a840982e41559e773
branch master
Author: Mark Kretschmann <kretschmann@kde.org>
Date:   Fri Jan 7 11:05:26 2011 +0100

    Fix crash on first startup, with clean config.
    
    This was caused by dereferencing a 0-pointer. We should do more testing
    for common cases like clean config, which are uncommon for us devs.
    
    BUG: 262307

diff --git a/src/playlist/PlaylistActions.cpp b/src/playlist/PlaylistActions.cpp
index 6abb90b..ee40bed 100644
--- a/src/playlist/PlaylistActions.cpp
+++ b/src/playlist/PlaylistActions.cpp
@@ -464,9 +464,11 @@ Playlist::Actions::restoreDefaultPlaylist()
     // non-collection Tracks will not be loaded correctly.
     The::playlistManager();
 
-    Playlists::PlaylistFilePtr playlist =
-            Playlists::loadPlaylistFile( Amarok::defaultPlaylistPath() );
-    playlist->triggerTrackLoad(); //playlist track loading is on demand.
+    Playlists::PlaylistFilePtr playlist = Playlists::loadPlaylistFile( Amarok::defaultPlaylistPath() );
+
+    if( playlist ) // This pointer will be 0 on first startup
+        playlist->triggerTrackLoad(); // playlist track loading is on demand
+
     if( playlist && playlist->tracks().count() > 0 )
     {
         Meta::TrackList tracks = playlist->tracks();
@@ -504,6 +506,7 @@ Playlist::Actions::restoreDefaultPlaylist()
         if( lastPlayingRow >= 0 )
             Playlist::ModelStack::instance()->bottom()->setActiveRow( lastPlayingRow );
     }
+
     //Check if we should load the first run jingle, since there is no saved playlist to load
     else if( AmarokConfig::playFirstRunJingle() )
     {