Bug 253794 - K3B crashed when I started it multiple times (opening an ISO file) [null QMainWindow::setStatusBar, KMainWindow::statusBar, K3b::MainWindow::slotStatusMsg]
Summary: K3B crashed when I started it multiple times (opening an ISO file) [null QMai...
Status: RESOLVED FIXED
Alias: None
Product: k3b
Classification: Applications
Component: general (show other bugs)
Version: 2.0.1
Platform: openSUSE Linux
: NOR crash
Target Milestone: ---
Assignee: Michał Małek
URL:
Keywords:
: 257439 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-10-10 23:34 UTC by Unknown
Modified: 2011-01-16 12:38 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 2.0.2


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Unknown 2010-10-10 23:34:40 UTC
Application: k3b (2.0.1)
KDE Platform Version: 4.5.2 (KDE 4.5.2)
Qt Version: 4.7.0
Operating System: Linux 2.6.34.7-0.3-desktop x86_64
Distribution: "openSUSE 11.3 (x86_64)"

-- Information about the crash:
In KTorrent, I double clicked on an ISO file many times rapidly. In 2 seconds, I opened K3B at least three times. But the program did not start, it crashed.

(I don't know whether it is important the download was not finished.)

-- Backtrace:
Application: K3b (k3b), signal: Segmentation fault
[Current thread is 1 (Thread 0x7fd0d2c9c780 (LWP 25041))]

Thread 2 (Thread 0x7fd0bb17b710 (LWP 25095)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:211
#1  0x00007fd0ce508675 in thread_sleep (ti=0x7fd0bb17ad90) at thread/qthread_unix.cpp:416
#2  0x00007fd0ce508826 in QThread::sleep (secs=<value optimized out>) at thread/qthread_unix.cpp:430
#3  0x00007fd0d26c1f5d in K3b::MediaCache::PollThread::run (this=0xaa22e0) at /usr/src/debug/k3b-2.0.1/libk3b/tools/k3bmediacache.cpp:106
#4  0x00007fd0ce5088be in QThreadPrivate::start (arg=0xaa22e0) at thread/qthread_unix.cpp:266
#5  0x00007fd0ccf6fa4f in start_thread (arg=0x7fd0bb17b710) at pthread_create.c:297
#6  0x00007fd0cd25682d in clone () from /lib64/libc.so.6
#7  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7fd0d2c9c780 (LWP 25041)):
[KCrash Handler]
#6  d_func (this=0x0, statusbar=0x9f9bb0) at widgets/qmainwindow.h:207
#7  QMainWindow::setStatusBar (this=0x0, statusbar=0x9f9bb0) at widgets/qmainwindow.cpp:545
#8  0x00007fd0cef8008a in KMainWindow::statusBar (this=0x0) at /usr/src/debug/kdelibs-4.5.2/kdeui/widgets/kmainwindow.cpp:1127
#9  0x0000000000511019 in K3b::MainWindow::slotStatusMsg (this=<value optimized out>, text=...) at /usr/src/debug/k3b-2.0.1/src/k3b.cpp:1176
#10 0x000000000051296e in K3b::MainWindow::openDocument (this=0x0, url=...) at /usr/src/debug/k3b-2.0.1/src/k3b.cpp:670
#11 0x00000000004fbc9d in K3b::Application::processCmdLineArgs (this=0x7fff2a72a4c0) at /usr/src/debug/k3b-2.0.1/src/k3bapplication.cpp:211
#12 0x00000000004fbe65 in K3b::Application::newInstance (this=0x7fff2a72a4c0) at /usr/src/debug/k3b-2.0.1/src/k3bapplication.cpp:161
#13 0x00007fd0cefcc948 in KUniqueApplicationAdaptor::newInstance (this=0x9a34d0, asn_id=<value optimized out>, args=...) at /usr/src/debug/kdelibs-4.5.2/kdeui/kernel/kuniqueapplication.cpp:440
#14 0x00007fd0cefcc9c2 in KUniqueApplicationAdaptor::qt_metacall (this=0x9a34d0, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7fff2a7289b0)
    at /usr/src/debug/kdelibs-4.5.2/build/kdeui/kuniqueapplication_p.moc:81
#15 0x00007fd0ccb0e3f8 in QDBusConnectionPrivate::deliverCall (this=0x7f4a50, object=0x9a34d0, msg=..., metaTypes=..., slotIdx=4) at qdbusintegrator.cpp:919
#16 0x00007fd0ccb0f205 in QDBusConnectionPrivate::activateCall (this=0x7f4a50, object=0x9a34d0, flags=337, msg=...) at qdbusintegrator.cpp:829
#17 0x00007fd0ccb0fa7e in QDBusConnectionPrivate::activateObject (this=0x7f4a50, node=..., msg=..., pathStartPos=<value optimized out>) at qdbusintegrator.cpp:1379
#18 0x00007fd0ccb0fcb8 in QDBusActivateObjectEvent::placeMetaCall (this=0xa992c0) at qdbusintegrator.cpp:1493
#19 0x00007fd0ce6077da in QObject::event (this=0x7fff2a72a4c0, e=<value optimized out>) at kernel/qobject.cpp:1211
#20 0x00007fd0cd9b9506 in QApplication::event (this=0x7fff2a72a4c0, e=0xa992c0) at kernel/qapplication.cpp:2439
#21 0x00007fd0cd9b6f34 in QApplicationPrivate::notify_helper (this=0x808800, receiver=0x7fff2a72a4c0, e=0xa992c0) at kernel/qapplication.cpp:4396
#22 0x00007fd0cd9bf35a in QApplication::notify (this=<value optimized out>, receiver=0x7fff2a72a4c0, e=0xa992c0) at kernel/qapplication.cpp:4277
#23 0x00007fd0cef3f826 in KApplication::notify (this=0x7fff2a72a4c0, receiver=0x7fff2a72a4c0, event=0xa992c0) at /usr/src/debug/kdelibs-4.5.2/kdeui/kernel/kapplication.cpp:310
#24 0x00007fd0ce5f39dc in QCoreApplication::notifyInternal (this=0x7fff2a72a4c0, receiver=0x7fff2a72a4c0, event=0xa992c0) at kernel/qcoreapplication.cpp:732
#25 0x00007fd0ce5f7185 in sendEvent (receiver=0x0, event_type=0, data=0x7d34d0) at kernel/qcoreapplication.h:215
#26 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x7d34d0) at kernel/qcoreapplication.cpp:1373
#27 0x00007fd0ce61e463 in sendPostedEvents (s=<value optimized out>) at kernel/qcoreapplication.h:220
#28 postEventSourceDispatch (s=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:277
#29 0x00007fd0c81c6a93 in g_main_dispatch (context=0x80b220) at gmain.c:1960
#30 IA__g_main_context_dispatch (context=0x80b220) at gmain.c:2513
#31 0x00007fd0c81c7270 in g_main_context_iterate (context=0x80b220, block=0, dispatch=1, self=<value optimized out>) at gmain.c:2591
#32 0x00007fd0c81c7510 in IA__g_main_context_iteration (context=0x80b220, may_block=0) at gmain.c:2654
#33 0x00007fd0ce61e5ff in QEventDispatcherGlib::processEvents (this=0x7d8f40, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:415
#34 0x00007fd0cda5aeee in QGuiEventDispatcherGlib::processEvents (this=<value optimized out>, flags=<value optimized out>) at kernel/qguieventdispatcher_glib.cpp:204
#35 0x00007fd0ce5f75af in QCoreApplication::processEvents (flags=...) at kernel/qcoreapplication.cpp:924
#36 0x000000000050a33c in K3b::Splash::addInfo (this=<value optimized out>, s=<value optimized out>) at /usr/src/debug/k3b-2.0.1/src/k3bsplash.cpp:93
#37 0x000000000050a3be in K3b::Splash::qt_metacall (this=0x9a3bf0, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fff2a7297f0)
    at /usr/src/debug/k3b-2.0.1/build/src/k3bsplash.moc:74
#38 0x00007fd0ce608b5f in QMetaObject::activate (sender=0x7fff2a72a4c0, m=<value optimized out>, local_signal_index=<value optimized out>, argv=0x7fff2a7297f0) at kernel/qobject.cpp:3272
#39 0x00000000004fb250 in K3b::Application::initializationInfo (this=<value optimized out>, _t1=<value optimized out>) at /usr/src/debug/k3b-2.0.1/build/src/k3bapplication.moc:93
#40 0x00000000004fbf82 in K3b::Application::init (this=0x7fff2a72a4c0) at /usr/src/debug/k3b-2.0.1/src/k3bapplication.cpp:123
#41 0x00000000004fc4bc in K3b::Application::qt_metacall (this=0x7fff2a72a4c0, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x99dac0)
    at /usr/src/debug/k3b-2.0.1/build/src/k3bapplication.moc:80
#42 0x00007fd0ce6077da in QObject::event (this=0x7fff2a72a4c0, e=<value optimized out>) at kernel/qobject.cpp:1211
#43 0x00007fd0cd9b9506 in QApplication::event (this=0x7fff2a72a4c0, e=0x984fc0) at kernel/qapplication.cpp:2439
#44 0x00007fd0cd9b6f34 in QApplicationPrivate::notify_helper (this=0x808800, receiver=0x7fff2a72a4c0, e=0x984fc0) at kernel/qapplication.cpp:4396
#45 0x00007fd0cd9bf35a in QApplication::notify (this=<value optimized out>, receiver=0x7fff2a72a4c0, e=0x984fc0) at kernel/qapplication.cpp:4277
#46 0x00007fd0cef3f826 in KApplication::notify (this=0x7fff2a72a4c0, receiver=0x7fff2a72a4c0, event=0x984fc0) at /usr/src/debug/kdelibs-4.5.2/kdeui/kernel/kapplication.cpp:310
#47 0x00007fd0ce5f39dc in QCoreApplication::notifyInternal (this=0x7fff2a72a4c0, receiver=0x7fff2a72a4c0, event=0x984fc0) at kernel/qcoreapplication.cpp:732
#48 0x00007fd0ce5f7185 in sendEvent (receiver=0x0, event_type=0, data=0x7d34d0) at kernel/qcoreapplication.h:215
#49 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x7d34d0) at kernel/qcoreapplication.cpp:1373
#50 0x00007fd0ce61e463 in sendPostedEvents (s=<value optimized out>) at kernel/qcoreapplication.h:220
#51 postEventSourceDispatch (s=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:277
#52 0x00007fd0c81c6a93 in g_main_dispatch (context=0x80b220) at gmain.c:1960
#53 IA__g_main_context_dispatch (context=0x80b220) at gmain.c:2513
#54 0x00007fd0c81c7270 in g_main_context_iterate (context=0x80b220, block=1, dispatch=1, self=<value optimized out>) at gmain.c:2591
#55 0x00007fd0c81c7510 in IA__g_main_context_iteration (context=0x80b220, may_block=1) at gmain.c:2654
#56 0x00007fd0ce61e5ff in QEventDispatcherGlib::processEvents (this=0x7d8f40, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:415
#57 0x00007fd0cda5aeee in QGuiEventDispatcherGlib::processEvents (this=<value optimized out>, flags=<value optimized out>) at kernel/qguieventdispatcher_glib.cpp:204
#58 0x00007fd0ce5f2e12 in QEventLoop::processEvents (this=<value optimized out>, flags=...) at kernel/qeventloop.cpp:149
#59 0x00007fd0ce5f3025 in QEventLoop::exec (this=0x7fff2a72a410, flags=...) at kernel/qeventloop.cpp:201
#60 0x00007fd0ce5f743b in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1009
#61 0x0000000000517cd2 in main (argc=2, argv=0x7fff2a72b0a8) at /usr/src/debug/k3b-2.0.1/src/main.cpp:151

Reported using DrKonqi
Comment 1 Dario Andres 2010-11-20 20:40:14 UTC
[Comment from a bug triager]
From bug 257439:
- What I was doing when the application crashed:
K3b crashed when open .iso file from mounted as read-only NTFS disc
Comment 2 Dario Andres 2010-11-20 20:40:19 UTC
*** Bug 257439 has been marked as a duplicate of this bug. ***
Comment 3 Michał Małek 2011-01-04 00:02:38 UTC
commit c86e7b784236befde86940ba70c9dce21f0a3589
branch 2.0
Author: Michal Malek <michalm@jabster.pl>
Date:   Mon Jan 3 23:40:09 2011 +0100

    Fixed race condition when running multiple k3b instances at the same time
    BUG: 253794

diff --git a/ChangeLog b/ChangeLog
index dc56653..7b8a80b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,7 @@ Bugfixes:
  * Crash when showing settings window (238819)
  * Fixed playlist sort order (249395)
  * Show K3b also in "System" category in KDE launch menus (250749)
+ * Crash when multiple instances start at the same time (253794)
 
 2.0.1
 =====
diff --git a/src/k3bapplication.cpp b/src/k3bapplication.cpp
index 069bca1..82c140d 100644
--- a/src/k3bapplication.cpp
+++ b/src/k3bapplication.cpp
@@ -63,8 +63,7 @@ K3b::Application::Core* K3b::Application::Core::s_k3bAppCore = 0;
 
 K3b::Application::Application()
     : KUniqueApplication(),
-      m_mainWindow(0),
-      m_needToInit(true)
+      m_mainWindow(0)
 {
     // insert library i18n data
     KGlobal::locale()->insertCatalog( "libk3bdevice" );
@@ -153,19 +152,19 @@ void K3b::Application::init()
 
 int K3b::Application::newInstance()
 {
-    if( m_needToInit ) {
-        //    init();
-        m_needToInit = false;
-    }
-    else
-        processCmdLineArgs();
-
+    processCmdLineArgs();
     return KUniqueApplication::newInstance();
 }
 
 
 bool K3b::Application::processCmdLineArgs()
 {
+    // There were cases when newInstance() has been called before init()
+    // (when user run k3b two times at once). It resulted in crash. So we
+    // check here if m_mainWindow is initalized and if not, we go back.
+    if( !m_mainWindow )
+        return false;
+
     KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
 
     bool showTips = true;
diff --git a/src/k3bapplication.h b/src/k3bapplication.h
index 9249191..9038806 100644
--- a/src/k3bapplication.h
+++ b/src/k3bapplication.h
@@ -62,8 +62,6 @@ namespace K3b {
         Core* m_core;
         //AudioServer* m_audioServer;
         MainWindow* m_mainWindow;
-
-        bool m_needToInit;
     };
Comment 4 Michał Małek 2011-01-04 00:04:25 UTC
commit c39f3bd1b700a074b29cdb578674c8e8f2740aee
branch master
Author: Michal Malek <michalm@jabster.pl>
Date:   Mon Jan 3 23:40:09 2011 +0100

    Fixed race condition when running multiple k3b instances at the same time
    BUG: 253794

diff --git a/ChangeLog b/ChangeLog
index 61499ce..a9f6443 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -22,6 +22,7 @@ Bugfixes:
  * Crash when showing settings window (238819)
  * Fixed playlist sort order (249395)
  * Show K3b also in "System" category in KDE launch menus (250749)
+ * Crash when multiple instances start at the same time (253794)
 
 2.0.1
 =====
diff --git a/src/k3bapplication.cpp b/src/k3bapplication.cpp
index 847362b..13707f7 100644
--- a/src/k3bapplication.cpp
+++ b/src/k3bapplication.cpp
@@ -61,8 +61,7 @@ K3b::Application::Core* K3b::Application::Core::s_k3bAppCore = 0;
 
 K3b::Application::Application()
     : KUniqueApplication(),
-      m_mainWindow(0),
-      m_needToInit(true)
+      m_mainWindow(0)
 {
     // insert library i18n data
     KGlobal::locale()->insertCatalog( "libk3bdevice" );
@@ -151,19 +150,19 @@ void K3b::Application::init()
 
 int K3b::Application::newInstance()
 {
-    if( m_needToInit ) {
-        //    init();
-        m_needToInit = false;
-    }
-    else
-        processCmdLineArgs();
-
+    processCmdLineArgs();
     return KUniqueApplication::newInstance();
 }
 
 
 bool K3b::Application::processCmdLineArgs()
 {
+    // There were cases when newInstance() has been called before init()
+    // (when user run k3b two times at once). It resulted in crash. So we
+    // check here if m_mainWindow is initalized and if not, we go back.
+    if( !m_mainWindow )
+        return false;
+
     KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
 
     bool showTips = true;
diff --git a/src/k3bapplication.h b/src/k3bapplication.h
index 0554494..5cced79 100644
--- a/src/k3bapplication.h
+++ b/src/k3bapplication.h
@@ -60,8 +60,6 @@ namespace K3b {
         Core* m_core;
         //AudioServer* m_audioServer;
         MainWindow* m_mainWindow;
-
-        bool m_needToInit;
     };