Bug 258187

Summary: Crash of Amarok when clicking "ok" with no album cover found
Product: [Applications] amarok Reporter: Mickaël <mprizee>
Component: Tools/Cover ManagerAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: crash CC: stuffcorpse
Priority: NOR    
Version: 2.4-GIT   
Target Milestone: 2.4.0   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 2.4
Sentry Crash Report:

Description Mickaël 2010-11-28 16:05:59 UTC
Application: amarok (2.4-GIT)
KDE Platform Version: 4.5.3 (KDE 4.5.3) (Compiled from sources)
Qt Version: 4.7.1
Operating System: Linux 2.6.36-ARCH x86_64
Distribution (Platform): Archlinux Packages

-- Information about the crash:
- What I was doing when the application crashed:
I was trying to add the cover on an album (Shakaponk - How we kill a star), I did not found the right cover (clicked on "clear" about two times), then I clicked "Ok" to resume to the cover manager... and crash.

-- Backtrace:
Application: Amarok (amarok), signal: Segmentation fault
[Current thread is 1 (Thread 0x7f6080d81780 (LWP 9361))]

Thread 8 (Thread 0x7f605fd96710 (LWP 9366)):
#0  0x00007f607bf6740c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#1  0x00007f607e32ac2b in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#2  0x00007f607b38d034 in ?? () from /usr/lib/libthreadweaver.so.4
#3  0x00007f607b38f6a3 in ?? () from /usr/lib/libthreadweaver.so.4
#4  0x00007f607b38f6bc in ?? () from /usr/lib/libthreadweaver.so.4
#5  0x00007f607b38e48f in ?? () from /usr/lib/libthreadweaver.so.4
#6  0x00007f607b38e518 in ThreadWeaver::Thread::run() () from /usr/lib/libthreadweaver.so.4
#7  0x00007f607e32a53e in ?? () from /usr/lib/libQtCore.so.4
#8  0x00007f607bf62cb0 in start_thread () from /lib/libpthread.so.0
#9  0x00007f607db099dd in clone () from /lib/libc.so.6
#10 0x0000000000000000 in ?? ()

Thread 7 (Thread 0x7f6060597710 (LWP 9367)):
#0  0x00007f607bf6740c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#1  0x00007f607e32ac2b in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#2  0x00007f607b38d034 in ?? () from /usr/lib/libthreadweaver.so.4
#3  0x00007f607b38f6a3 in ?? () from /usr/lib/libthreadweaver.so.4
#4  0x00007f607b38f6bc in ?? () from /usr/lib/libthreadweaver.so.4
#5  0x00007f607b38f6bc in ?? () from /usr/lib/libthreadweaver.so.4
#6  0x00007f607b38e48f in ?? () from /usr/lib/libthreadweaver.so.4
#7  0x00007f607b38e518 in ThreadWeaver::Thread::run() () from /usr/lib/libthreadweaver.so.4
#8  0x00007f607e32a53e in ?? () from /usr/lib/libQtCore.so.4
#9  0x00007f607bf62cb0 in start_thread () from /lib/libpthread.so.0
#10 0x00007f607db099dd in clone () from /lib/libc.so.6
#11 0x0000000000000000 in ?? ()

Thread 6 (Thread 0x7f60551e2710 (LWP 9370)):
#0  0x00007f607bf6740c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#1  0x00007f607e32ac2b in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#2  0x00007f607b38d034 in ?? () from /usr/lib/libthreadweaver.so.4
#3  0x00007f607b38f6a3 in ?? () from /usr/lib/libthreadweaver.so.4
#4  0x00007f607b38e48f in ?? () from /usr/lib/libthreadweaver.so.4
#5  0x00007f607b38e518 in ThreadWeaver::Thread::run() () from /usr/lib/libthreadweaver.so.4
#6  0x00007f607e32a53e in ?? () from /usr/lib/libQtCore.so.4
#7  0x00007f607bf62cb0 in start_thread () from /lib/libpthread.so.0
#8  0x00007f607db099dd in clone () from /lib/libc.so.6
#9  0x0000000000000000 in ?? ()

Thread 5 (Thread 0x7f604ffff710 (LWP 9371)):
#0  0x00007f607bf6740c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#1  0x00007f607e32ac2b in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#2  0x00007f607b38d034 in ?? () from /usr/lib/libthreadweaver.so.4
#3  0x00007f607b38f6a3 in ?? () from /usr/lib/libthreadweaver.so.4
#4  0x00007f607b38f6bc in ?? () from /usr/lib/libthreadweaver.so.4
#5  0x00007f607b38f6bc in ?? () from /usr/lib/libthreadweaver.so.4
#6  0x00007f607b38f6bc in ?? () from /usr/lib/libthreadweaver.so.4
#7  0x00007f607b38f6bc in ?? () from /usr/lib/libthreadweaver.so.4
#8  0x00007f607b38e48f in ?? () from /usr/lib/libthreadweaver.so.4
#9  0x00007f607b38e518 in ThreadWeaver::Thread::run() () from /usr/lib/libthreadweaver.so.4
#10 0x00007f607e32a53e in ?? () from /usr/lib/libQtCore.so.4
#11 0x00007f607bf62cb0 in start_thread () from /lib/libpthread.so.0
#12 0x00007f607db099dd in clone () from /lib/libc.so.6
#13 0x0000000000000000 in ?? ()

Thread 4 (Thread 0x7f6047fff710 (LWP 9376)):
#0  0x00007f607bf6740c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#1  0x00007f6079cb97c4 in ?? () from /usr/lib/libQtScript.so.4
#2  0x00007f6079cb97f9 in ?? () from /usr/lib/libQtScript.so.4
#3  0x00007f607bf62cb0 in start_thread () from /lib/libpthread.so.0
#4  0x00007f607db099dd in clone () from /lib/libc.so.6
#5  0x0000000000000000 in ?? ()

Thread 3 (Thread 0x7f6043a3f710 (LWP 9389)):
#0  0x00007f607bf6740c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#1  0x00007f607e32ac2b in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#2  0x00007f607f2a6794 in ?? () from /usr/lib/libQtGui.so.4
#3  0x00007f607e32a53e in ?? () from /usr/lib/libQtCore.so.4
#4  0x00007f607bf62cb0 in start_thread () from /lib/libpthread.so.0
#5  0x00007f607db099dd in clone () from /lib/libc.so.6
#6  0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7f6042635710 (LWP 9390)):
#0  0x00007f607db01173 in poll () from /lib/libc.so.6
#1  0x00007f60775f1134 in ?? () from /usr/lib/libglib-2.0.so.0
#2  0x00007f60775f166d in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#3  0x00007f607e43dfa6 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#4  0x00007f607e412252 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#5  0x00007f607e41249c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#6  0x00007f607e327d64 in QThread::exec() () from /usr/lib/libQtCore.so.4
#7  0x00007f607e3f3e38 in ?? () from /usr/lib/libQtCore.so.4
#8  0x00007f607e32a53e in ?? () from /usr/lib/libQtCore.so.4
#9  0x00007f607bf62cb0 in start_thread () from /lib/libpthread.so.0
#10 0x00007f607db099dd in clone () from /lib/libc.so.6
#11 0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7f6080d81780 (LWP 9361)):
[KCrash Handler]
#6  0x00007f607ee8a740 in QPixmap::isNull() const () from /usr/lib/libQtGui.so.4
#7  0x00007f607fe3d6f6 in CoverFoundItem::hasBigPix (this=0x0) at /donnees/amarok-git/src/covermanager/CoverFoundDialog.h:172
#8  0x00007f607fe38a2c in CoverFoundDialog::slotButtonClicked (this=0x4285110, button=4) at /donnees/amarok-git/src/covermanager/CoverFoundDialog.cpp:429
#9  0x00007f60808300c2 in KDialog::qt_metacall(QMetaObject::Call, int, void**) () from /usr/lib/libkdeui.so.5
#10 0x00007f607fe3ccef in CoverFoundDialog::qt_metacall (this=0x4285110, _c=QMetaObject::InvokeMetaMethod, _id=69, _a=0x7fff7632d990) at /var/build/src/CoverFoundDialog.moc:112
#11 0x00007f607e42833f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#12 0x00007f607e42c13e in QSignalMapper::mapped(int) () from /usr/lib/libQtCore.so.4
#13 0x00007f607e42c246 in QSignalMapper::map(QObject*) () from /usr/lib/libQtCore.so.4
#14 0x00007f607e42c980 in QSignalMapper::qt_metacall(QMetaObject::Call, int, void**) () from /usr/lib/libQtCore.so.4
#15 0x00007f607e42833f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#16 0x00007f607f425c52 in QAbstractButton::clicked(bool) () from /usr/lib/libQtGui.so.4
#17 0x00007f607f16ddfb in ?? () from /usr/lib/libQtGui.so.4
#18 0x00007f607f16f3cb in ?? () from /usr/lib/libQtGui.so.4
#19 0x00007f607f16f63c in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/libQtGui.so.4
#20 0x00007f607ee06978 in QWidget::event(QEvent*) () from /usr/lib/libQtGui.so.4
#21 0x00007f607edb52b4 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#22 0x00007f607edba64a in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#23 0x00007f60808c2226 in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#24 0x00007f607e412ebc in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#25 0x00007f607edb62b5 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib/libQtGui.so.4
#26 0x00007f607ee34968 in ?? () from /usr/lib/libQtGui.so.4
#27 0x00007f607ee33029 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/libQtGui.so.4
#28 0x00007f607ee5a592 in ?? () from /usr/lib/libQtGui.so.4
#29 0x00007f60775f0bf3 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#30 0x00007f60775f13d0 in ?? () from /usr/lib/libglib-2.0.so.0
#31 0x00007f60775f166d in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#32 0x00007f607e43df4f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#33 0x00007f607ee5a23e in ?? () from /usr/lib/libQtGui.so.4
#34 0x00007f607e412252 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#35 0x00007f607e41249c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#36 0x00007f607e41699b in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#37 0x0000000000407748 in main (argc=2, argv=0x7fff763310f8) at /donnees/amarok-git/src/main.cpp:248

Reported using DrKonqi
Comment 1 Myriam Schweingruber 2010-11-29 18:02:18 UTC
Confirmed with latest git
Comment 2 Myriam Schweingruber 2010-11-29 18:04:16 UTC
Oh, this is actualkly a duplicate of an existing bug.

*** This bug has been marked as a duplicate of bug 257454 ***
Comment 3 Rick W. Chen 2010-11-30 22:12:12 UTC
This is not a duplicate of BUG 257454. The stack trace looks quite different.
Comment 4 Rick W. Chen 2010-11-30 22:36:11 UTC
commit 8ba91b250e0c36e6da3a4e9e1aa26b12dabf0de0
branch master
Author: Rick W. Chen <stuffcorpse@archlinux.us>
Date:   Wed Dec 1 10:12:55 2010 +1300

    Fix cover dialog crash when pressing Ok when nothing is selected
    
    BUG:258187

diff --git a/ChangeLog b/ChangeLog
index 97e9661..581f47f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -74,6 +74,7 @@ VERSION 2.4-Beta 1
       pressing SHIFT while clicking the action will bypass trash.
 
   BUGFIXES:
+    * Fixed cover dialog crash pressing Ok when nothing is selected. (BR 258187)
     * Title labels incorrectly used the text color from the plasma theme.
       This caused trouble with the fixed plasma theme and light color schemes.
     * Fixed a data-loss bug where the user could lose changes he made to the current
diff --git a/src/covermanager/CoverFoundDialog.cpp b/src/covermanager/CoverFoundDialog.cpp
index 36f83cb..e92946e 100644
--- a/src/covermanager/CoverFoundDialog.cpp
+++ b/src/covermanager/CoverFoundDialog.cpp
@@ -423,7 +423,12 @@ void CoverFoundDialog::slotButtonClicked( int button )
 {
     if( button == KDialog::Ok )
     {
-        CoverFoundItem *item = static_cast< CoverFoundItem* >( m_view->currentItem() );
+        CoverFoundItem *item = dynamic_cast< CoverFoundItem* >( m_view->currentItem() );
+        if( !item )
+        {
+            reject();
+            return;
+        }
 
         bool gotBigPix( true );
         if( !item->hasBigPix() )