Bug 293191

Summary: Crash while changing branch: ProjectModel not threadsafe!
Product: [Applications] kdevelop Reporter: Andreas Cord-Landwehr <cordlandwehr>
Component: Build tools: CMakeAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: crash CC: aleixpol, b.brachaczek, bugs.kde.org, glad08, intelfx, joris.guisson, jtamate, mwoehlke.floss, peter.aberline, prcoder, sean.lindskog, steffen.ohrendorf, tim, valir, vinesworth, zohn.joidberg
Priority: VHI    
Version: unspecified   
Target Milestone: 4.2.3   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: New crash information added by DrKonqi
attempt
New crash information added by DrKonqi
New crash information added by DrKonqi
New crash information added by DrKonqi

Description Andreas Cord-Landwehr 2012-02-03 09:14:52 UTC
Application: kdevelop (4.2.81)
KDE Platform Version: 4.7.4 (4.7.4) (Compiled from sources)
Qt Version: 4.7.4
Operating System: Linux 3.0.0-1-686-pae i686
Distribution: Debian GNU/Linux testing (wheezy)

-- Information about the crash:
- What I was doing when the application crashed:
In KDevelop ca. 10 cpp/h files were open. In parallel I worked at console and did a few branch checkouts (in my case master -> KDE/4.8 -> KDE/4.7) that changed the open files. At the third checkout KDevelp crashed. (I could reproduce this behavior, though the number of checkouts for this crash slighly differs sometimes.)

-- Backtrace:
Application: KDevelop (kdevelop), signal: Aborted
[Current thread is 1 (Thread 0xb26c8710 (LWP 3749))]

Thread 12 (Thread 0xaeaa9b70 (LWP 3750)):
#0  0xb77e5424 in __kernel_vsyscall ()
#1  0xb5d81703 in pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/pthread_cond_timedwait.S:236
#2  0xb5fefad4 in __pthread_cond_timedwait (cond=0xa2e3650, mutex=0xa2e3638, abstime=0xaeaa92d8) at forward.c:152
#3  0xb6c6ab5e in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#4  0xb570b15a in KDevelop::DUChainPrivate::CleanupThread::run (this=0xa2fd6d0) at ../../language/duchain/duchain.cpp:282
#5  0xb6c6a6c3 in QThreadPrivate::start(void*) () from /usr/lib/libQtCore.so.4
#6  0xb5d7cc39 in start_thread (arg=0xaeaa9b70) at pthread_create.c:304
#7  0xb5fe298e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
Backtrace stopped: Not enough registers or memory available to unwind further

Thread 11 (Thread 0xace8db70 (LWP 3752)):
#0  0xb77e5424 in __kernel_vsyscall ()
#1  0xb5fefdd1 in __lll_lock_wait_private () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/lowlevellock.S:95
#2  0xb5f86b67 in _L_lock_9661 () from /lib/i386-linux-gnu/i686/cmov/libc.so.6
#3  0xb5f85396 in *__GI___libc_free (mem=0xae102e88) at malloc.c:3736
#4  0xb51fc38b in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#5  0xb51fc666 in g_free () from /lib/i386-linux-gnu/libglib-2.0.so.0
#6  0xb51f1d7a in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#7  0xb6d9333f in QEventDispatcherGlib::~QEventDispatcherGlib() () from /usr/lib/libQtCore.so.4
#8  0xb6d93552 in QEventDispatcherGlib::~QEventDispatcherGlib() () from /usr/lib/libQtCore.so.4
#9  0xb6c6963c in QThreadPrivate::finish(void*) () from /usr/lib/libQtCore.so.4
#10 0xb6c6a6cb in QThreadPrivate::start(void*) () from /usr/lib/libQtCore.so.4
#11 0xb5d7cc39 in start_thread (arg=0xace8db70) at pthread_create.c:304
#12 0xb5fe298e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
Backtrace stopped: Not enough registers or memory available to unwind further

Thread 10 (Thread 0xab576b70 (LWP 3754)):
#0  0xb5cd0e11 in *__GI_clock_gettime (clock_id=1, tp=0xab576048) at ../sysdeps/unix/clock_gettime.c:116
#1  0xb6cc17f5 in qt_gettime() () from /usr/lib/libQtCore.so.4
#2  0xb6d93fa6 in QTimerInfoList::updateCurrentTime() () from /usr/lib/libQtCore.so.4
#3  0xb6d9430a in QTimerInfoList::timerWait(timeval&) () from /usr/lib/libQtCore.so.4
#4  0xb6d92b63 in timerSourcePrepareHelper(GTimerSource*, int*) () from /usr/lib/libQtCore.so.4
#5  0xb6d92bfd in timerSourcePrepare(_GSource*, int*) () from /usr/lib/libQtCore.so.4
#6  0xb51f5054 in g_main_context_prepare () from /lib/i386-linux-gnu/libglib-2.0.so.0
#7  0xb51f5e17 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#8  0xb51f640a in g_main_context_iteration () from /lib/i386-linux-gnu/libglib-2.0.so.0
#9  0xb6d93637 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#10 0xb6d6433d in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#11 0xb6d64581 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#12 0xb6c6785b in QThread::exec() () from /usr/lib/libQtCore.so.4
#13 0xb580db86 in KDevelop::CompletionWorkerThread::run (this=0xa4b28d0) at ../../language/codecompletion/codecompletionmodel.cpp:84
#14 0xb6c6a6c3 in QThreadPrivate::start(void*) () from /usr/lib/libQtCore.so.4
#15 0xb5d7cc39 in start_thread (arg=0xab576b70) at pthread_create.c:304
#16 0xb5fe298e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
Backtrace stopped: Not enough registers or memory available to unwind further

Thread 9 (Thread 0xaad75b70 (LWP 3755)):
#0  0xb51f5860 in g_main_context_dispatch () from /lib/i386-linux-gnu/libglib-2.0.so.0
#1  0xb51f6170 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#2  0xb51f640a in g_main_context_iteration () from /lib/i386-linux-gnu/libglib-2.0.so.0
#3  0xb6d93637 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#4  0xb6d6433d in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#5  0xb6d64581 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#6  0xb6c6785b in QThread::exec() () from /usr/lib/libQtCore.so.4
#7  0xb580db86 in KDevelop::CompletionWorkerThread::run (this=0xae103150) at ../../language/codecompletion/codecompletionmodel.cpp:84
#8  0xb6c6a6c3 in QThreadPrivate::start(void*) () from /usr/lib/libQtCore.so.4
#9  0xb5d7cc39 in start_thread (arg=0xaad75b70) at pthread_create.c:304
#10 0xb5fe298e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
Backtrace stopped: Not enough registers or memory available to unwind further

Thread 8 (Thread 0xa7e2eb70 (LWP 3760)):
#0  0xb77e5424 in __kernel_vsyscall ()
#1  0xb5d8120a in __pthread_cond_wait (cond=0xb10932f0, mutex=0xb10932d8) at pthread_cond_wait.c:153
#2  0xb5fefa7d in __pthread_cond_wait (cond=0xb10932f0, mutex=0xb10932d8) at forward.c:139
#3  0xb0f8f5c9 in ?? () from /usr/lib/libQtScript.so.4
#4  0xb0f8f60f in ?? () from /usr/lib/libQtScript.so.4
#5  0xb5d7cc39 in start_thread (arg=0xa7e2eb70) at pthread_create.c:304
#6  0xb5fe298e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
Backtrace stopped: Not enough registers or memory available to unwind further

Thread 7 (Thread 0xa6fafb70 (LWP 3761)):
#0  0xb5cd0e11 in *__GI_clock_gettime (clock_id=1, tp=0xa6faf028) at ../sysdeps/unix/clock_gettime.c:116
#1  0xb6cc17f5 in qt_gettime() () from /usr/lib/libQtCore.so.4
#2  0xb6d93fa6 in QTimerInfoList::updateCurrentTime() () from /usr/lib/libQtCore.so.4
#3  0xb6d9430a in QTimerInfoList::timerWait(timeval&) () from /usr/lib/libQtCore.so.4
#4  0xb6d92b63 in timerSourcePrepareHelper(GTimerSource*, int*) () from /usr/lib/libQtCore.so.4
#5  0xb6d92bfd in timerSourcePrepare(_GSource*, int*) () from /usr/lib/libQtCore.so.4
#6  0xb51f5054 in g_main_context_prepare () from /lib/i386-linux-gnu/libglib-2.0.so.0
#7  0xb51f5e17 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#8  0xb51f640a in g_main_context_iteration () from /lib/i386-linux-gnu/libglib-2.0.so.0
#9  0xb6d93637 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#10 0xb6d6433d in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#11 0xb6d64581 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#12 0xb6c6785b in QThread::exec() () from /usr/lib/libQtCore.so.4
#13 0xb6d44e7d in QInotifyFileSystemWatcherEngine::run() () from /usr/lib/libQtCore.so.4
#14 0xb6c6a6c3 in QThreadPrivate::start(void*) () from /usr/lib/libQtCore.so.4
#15 0xb5d7cc39 in start_thread (arg=0xa6fafb70) at pthread_create.c:304
#16 0xb5fe298e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
Backtrace stopped: Not enough registers or memory available to unwind further

Thread 6 (Thread 0xa5fadb70 (LWP 3781)):
#0  0xb77e5424 in __kernel_vsyscall ()
#1  0xb5d8120a in __pthread_cond_wait (cond=0xb4c50770, mutex=0xb4c50758) at pthread_cond_wait.c:153
#2  0xb5fefa7d in __pthread_cond_wait (cond=0xb4c50770, mutex=0xb4c50758) at forward.c:139
#3  0xb451ebab in ?? () from /usr/lib/libQtWebKit.so.4
#4  0xb451eccf in ?? () from /usr/lib/libQtWebKit.so.4
#5  0xb5d7cc39 in start_thread (arg=0xa5fadb70) at pthread_create.c:304
#6  0xb5fe298e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
Backtrace stopped: Not enough registers or memory available to unwind further

Thread 5 (Thread 0xa67aeb70 (LWP 3782)):
#0  0xb77e5424 in __kernel_vsyscall ()
#1  0xb5fd4fa6 in *__GI___poll (fds=0xb606bff4, nfds=1, timeout=9571) at ../sysdeps/unix/sysv/linux/poll.c:87
#2  0xb5204afb in g_poll () from /lib/i386-linux-gnu/libglib-2.0.so.0
#3  0xb51f6076 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#4  0xb51f640a in g_main_context_iteration () from /lib/i386-linux-gnu/libglib-2.0.so.0
#5  0xb6d93637 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#6  0xb6d6433d in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#7  0xb6d64581 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#8  0xb6c6785b in QThread::exec() () from /usr/lib/libQtCore.so.4
#9  0xb6c6794b in QThread::run() () from /usr/lib/libQtCore.so.4
#10 0xb6c6a6c3 in QThreadPrivate::start(void*) () from /usr/lib/libQtCore.so.4
#11 0xb5d7cc39 in start_thread (arg=0xa67aeb70) at pthread_create.c:304
#12 0xb5fe298e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
Backtrace stopped: Not enough registers or memory available to unwind further

Thread 4 (Thread 0xa38a5b70 (LWP 3945)):
#0  0xb77e5424 in __kernel_vsyscall ()
#1  0xb5d8120a in __pthread_cond_wait (cond=0xa21c280, mutex=0xa21c268) at pthread_cond_wait.c:153
#2  0xb5fefa7d in __pthread_cond_wait (cond=0xa21c280, mutex=0xa21c268) at forward.c:139
#3  0xb6c6abd0 in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#4  0xb4c64266 in ThreadWeaver::WeaverImpl::blockThreadUntilJobsAreBeingAssigned (this=0xa21c198, th=0xbde7ae0) at ../../../threadweaver/Weaver/WeaverImpl.cpp:365
#5  0xb4c66d5b in ThreadWeaver::WorkingHardState::waitForAvailableJob (this=0xa17fea0, th=0xbde7ae0) at ../../../threadweaver/Weaver/WorkingHardState.cpp:80
#6  0xb4c63e9a in ThreadWeaver::WeaverImpl::waitForAvailableJob (this=0xa21c198, th=0xbde7ae0) at ../../../threadweaver/Weaver/WeaverImpl.cpp:356
#7  0xb4c66e5c in ThreadWeaver::WorkingHardState::applyForWork (this=0xa17fea0, th=0xbde7ae0) at ../../../threadweaver/Weaver/WorkingHardState.cpp:71
#8  0xb4c63df3 in ThreadWeaver::WeaverImpl::applyForWork (this=0xa21c198, th=0xbde7ae0, previous=0xab79e38) at ../../../threadweaver/Weaver/WeaverImpl.cpp:351
#9  0xb4c65994 in ThreadWeaver::ThreadRunHelper::run (this=0xa38a5314, parent=0xa21c198, th=0xbde7ae0) at ../../../threadweaver/Weaver/Thread.cpp:87
#10 0xb4c65a4a in ThreadWeaver::Thread::run (this=0xbde7ae0) at ../../../threadweaver/Weaver/Thread.cpp:142
#11 0xb6c6a6c3 in QThreadPrivate::start(void*) () from /usr/lib/libQtCore.so.4
#12 0xb5d7cc39 in start_thread (arg=0xa38a5b70) at pthread_create.c:304
#13 0xb5fe298e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
Backtrace stopped: Not enough registers or memory available to unwind further

Thread 3 (Thread 0xa30a4b70 (LWP 3946)):
#0  0xb77e5424 in __kernel_vsyscall ()
#1  0xb5d8120a in __pthread_cond_wait (cond=0xa21c280, mutex=0xa21c268) at pthread_cond_wait.c:153
#2  0xb5fefa7d in __pthread_cond_wait (cond=0xa21c280, mutex=0xa21c268) at forward.c:139
#3  0xb6c6abd0 in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#4  0xb4c64266 in ThreadWeaver::WeaverImpl::blockThreadUntilJobsAreBeingAssigned (this=0xa21c198, th=0xbde53e0) at ../../../threadweaver/Weaver/WeaverImpl.cpp:365
#5  0xb4c66d5b in ThreadWeaver::WorkingHardState::waitForAvailableJob (this=0xa17fea0, th=0xbde53e0) at ../../../threadweaver/Weaver/WorkingHardState.cpp:80
#6  0xb4c63e9a in ThreadWeaver::WeaverImpl::waitForAvailableJob (this=0xa21c198, th=0xbde53e0) at ../../../threadweaver/Weaver/WeaverImpl.cpp:356
#7  0xb4c66e5c in ThreadWeaver::WorkingHardState::applyForWork (this=0xa17fea0, th=0xbde53e0) at ../../../threadweaver/Weaver/WorkingHardState.cpp:71
#8  0xb4c63df3 in ThreadWeaver::WeaverImpl::applyForWork (this=0xa21c198, th=0xbde53e0, previous=0x0) at ../../../threadweaver/Weaver/WeaverImpl.cpp:351
#9  0xb4c66e78 in ThreadWeaver::WorkingHardState::applyForWork (this=0xa17fea0, th=0xbde53e0) at ../../../threadweaver/Weaver/WorkingHardState.cpp:74
#10 0xb4c63df3 in ThreadWeaver::WeaverImpl::applyForWork (this=0xa21c198, th=0xbde53e0, previous=0xb337780) at ../../../threadweaver/Weaver/WeaverImpl.cpp:351
#11 0xb4c65994 in ThreadWeaver::ThreadRunHelper::run (this=0xa30a4314, parent=0xa21c198, th=0xbde53e0) at ../../../threadweaver/Weaver/Thread.cpp:87
#12 0xb4c65a4a in ThreadWeaver::Thread::run (this=0xbde53e0) at ../../../threadweaver/Weaver/Thread.cpp:142
#13 0xb6c6a6c3 in QThreadPrivate::start(void*) () from /usr/lib/libQtCore.so.4
#14 0xb5d7cc39 in start_thread (arg=0xa30a4b70) at pthread_create.c:304
#15 0xb5fe298e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
Backtrace stopped: Not enough registers or memory available to unwind further

Thread 2 (Thread 0xa4d47b70 (LWP 4223)):
#0  0xb77e5424 in __kernel_vsyscall ()
#1  0xb5d8120a in __pthread_cond_wait (cond=0xe4a6838, mutex=0xe4a6820) at pthread_cond_wait.c:153
#2  0xb5fefa7d in __pthread_cond_wait (cond=0xe4a6838, mutex=0xe4a6820) at forward.c:139
#3  0xb6c6abd0 in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#4  0xb6c67062 in QSemaphore::acquire(int) () from /usr/lib/libQtCore.so.4
#5  0xb6d6d134 in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const () from /usr/lib/libQtCore.so.4
#6  0xb6d6f608 in QMetaObject::invokeMethod(QObject*, char const*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) () from /usr/lib/libQtCore.so.4
#7  0xb58f9aa2 in invokeMethod (val9=<optimized out>, val8=<optimized out>, val7=<optimized out>, val6=<optimized out>, val5=<optimized out>, val4=<optimized out>, val3=<optimized out>, val2=<optimized out>, val1=<optimized out>, val0=<optimized out>, type=<optimized out>, member=0xb590fc5a "dataChanged", obj=<optimized out>) at /usr/include/qt4/QtCore/qobjectdefs.h:408
#8  KDevelop::ProjectBaseItem::setText (this=0xa1a43300, text=...) at ../../project/projectmodel.cpp:335
#9  0xb58f9b47 in KDevelop::ProjectBaseItem::setUrl (this=0xa1a43300, url=...) at ../../project/projectmodel.cpp:440
#10 0xb58fa682 in KDevelop::ProjectFolderItem::setUrl (this=0xa1a43300, url=...) at ../../project/projectmodel.cpp:573
#11 0xb58fbf82 in KDevelop::ProjectFolderItem::ProjectFolderItem (this=0xa1a43300, project=0xb27e138, dir=..., parent=0xa0ca7858) at ../../project/projectmodel.cpp:562
#12 0xb58fbfda in KDevelop::ProjectBuildFolderItem::ProjectBuildFolderItem (this=0xa1a43300, project=0xb27e138, dir=..., parent=0xa0ca7858) at ../../project/projectmodel.cpp:661
#13 0xac5ed262 in CMakeFolderItem::CMakeFolderItem (this=0xa1a43300, project=0xb27e138, folder=..., build=..., item=0xa0ca7858) at ../../../projectmanagers/cmake/cmakemodelitems.cpp:32
#14 0xa7018dd5 in CMakeManager::parse (this=0xae50860, item=0xa0ca7858) at ../../../projectmanagers/cmake/cmakemanager.cpp:741
#15 0xb5901524 in import (folder=<optimized out>, this=0xbe6bc48) at ../../project/importprojectjob.cpp:53
#16 KDevelop::ImportProjectJobPrivate::import (this=0xbe6bc48, folder=0xa3dff290) at ../../project/importprojectjob.cpp:57
#17 0xb5900eb8 in QtConcurrent::VoidStoredMemberFunctionPointerCall1<void, KDevelop::ImportProjectJobPrivate, KDevelop::ProjectFolderItem*, KDevelop::ProjectFolderItem*>::runFunctor (this=0x9f5b948) at /usr/include/qt4/QtCore/qtconcurrentstoredfunctioncall.h:426
#18 0xb5900fde in run (this=0x9f5b948) at /usr/include/qt4/QtCore/qtconcurrentrunbase.h:120
#19 QtConcurrent::RunFunctionTask<void>::run (this=0x9f5b948) at /usr/include/qt4/QtCore/qtconcurrentrunbase.h:114
#20 0xb6c5e641 in QThreadPoolThread::run() () from /usr/lib/libQtCore.so.4
#21 0xb6c6a6c3 in QThreadPrivate::start(void*) () from /usr/lib/libQtCore.so.4
#22 0xb5d7cc39 in start_thread (arg=0xa4d47b70) at pthread_create.c:304
#23 0xb5fe298e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
Backtrace stopped: Not enough registers or memory available to unwind further

Thread 1 (Thread 0xb26c8710 (LWP 3749)):
[KCrash Handler]
#7  0xb77e5424 in __kernel_vsyscall ()
#8  0xb5f408f1 in *__GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#9  0xb5f43d22 in *__GI_abort () at abort.c:92
#10 0xb5f76995 in __libc_message (do_abort=2, fmt=0xb604bab0 "*** glibc detected *** %s: %s: 0x%s ***\n") at ../sysdeps/unix/sysv/linux/libc_fatal.c:189
#11 0xb5f80a81 in malloc_printerr (action=<optimized out>, str=0x6 <Address 0x6 out of bounds>, ptr=0xa3badaa0) at malloc.c:6283
#12 0xb5f822e8 in _int_free (av=<optimized out>, p=<optimized out>) at malloc.c:4795
#13 0xb5f8539d in *__GI___libc_free (mem=0xa3badaa0) at malloc.c:3738
#14 0xb6c63ddb in qFree(void*) () from /usr/lib/libQtCore.so.4
#15 0xb6cb50e2 in QString::free(QString::Data*) () from /usr/lib/libQtCore.so.4
#16 0xb58f9659 in ~QString (this=0xbf98c95c, __in_chrg=<optimized out>) at /usr/include/qt4/QtCore/qstring.h:883
#17 lessThan (item=0x9fe9eab8, this=0xa1a43300) at ../../project/projectmodel.cpp:377
#18 KDevelop::ProjectBaseItem::lessThan (this=0xa1a43300, item=0x9fe9eab8) at ../../project/projectmodel.cpp:363
#19 0xb5907ab8 in ProjectProxyModel::lessThan (this=0xb192ca8, left=..., right=...) at ../../project/projectproxymodel.cpp:44
#20 0xb68c2607 in QSortFilterProxyModelPrivate::proxy_intervals_for_source_items_to_add(QVector<int> const&, QVector<int> const&, QModelIndex const&, Qt::Orientation) const () from /usr/lib/libQtGui.so.4
#21 0xb68c2a9d in QSortFilterProxyModelPrivate::insert_source_items(QVector<int>&, QVector<int>&, QVector<int> const&, QModelIndex const&, Qt::Orientation, bool) () from /usr/lib/libQtGui.so.4
#22 0xb68c8343 in QSortFilterProxyModelPrivate::_q_sourceDataChanged(QModelIndex const&, QModelIndex const&) () from /usr/lib/libQtGui.so.4
#23 0xb68c99f1 in QSortFilterProxyModel::qt_metacall(QMetaObject::Call, int, void**) () from /usr/lib/libQtGui.so.4
#24 0xb6d6b6cd in QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib/libQtCore.so.4
#25 0xb6d760d5 in QMetaCallEvent::placeMetaCall(QObject*) () from /usr/lib/libQtCore.so.4
#26 0xb6d7d5ef in QObject::event(QEvent*) () from /usr/lib/libQtCore.so.4
#27 0xb629d904 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#28 0xb62a2c92 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#29 0xb71234e1 in KApplication::notify (this=0xbf98d544, receiver=0xb192ca8, event=0xa0c77820) at ../../kdeui/kernel/kapplication.cpp:311
#30 0xb6d6531e in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#31 0xb6d68ae4 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/libQtCore.so.4
#32 0xb6d68c2c in QCoreApplication::sendPostedEvents(QObject*, int) () from /usr/lib/libQtCore.so.4
#33 0xb6d931a4 in postEventSourceDispatch(_GSource*, int (*)(void*), void*) () from /usr/lib/libQtCore.so.4
#34 0xb51f5a3f in g_main_context_dispatch () from /lib/i386-linux-gnu/libglib-2.0.so.0
#35 0xb51f6170 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#36 0xb51f640a in g_main_context_iteration () from /lib/i386-linux-gnu/libglib-2.0.so.0
#37 0xb6d935d7 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#38 0xb6352b9a in QGuiEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtGui.so.4
#39 0xb6d6433d in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#40 0xb6d64581 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#41 0xb6d68cda in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#42 0xb629b784 in QApplication::exec() () from /usr/lib/libQtGui.so.4
#43 0x08051670 in main (argc=<optimized out>, argv=) at ../../app/main.cpp:479

Possible duplicates by query: bug 287270, bug 268173, bug 265925.

Reported using DrKonqi
Comment 1 Milian Wolff 2012-02-06 21:20:02 UTC
Jup, pretty clear due to using the thread-*un*-safe Project API from the background in the cmake manager...

Aleix, you should never work on project items that are added to the model in a background thread... So for the initial import you could parse the stuff in the background thread and only add the item to the project model afterwards (I think you do that already).

Further actions like manual reloading or handling KDirWatcher signals should be handled in the main thread. Or, alternatively, remove the parent item from the model and add it again after you finished processing.

I don't like both approaches btw. Rather I think should be handling asynchronously instead of multithreaded. Queue (via signals) the folders that need to be imported and handle them all in the main thread. You could - if that is really that slow, parse the CMakeFiles in a background thread but once you interpret them to alter the ProjectModel, you have to do it in the mainthread.
Comment 2 Matthew Woehlke 2012-06-19 23:05:27 UTC
Created attachment 71968 [details]
New crash information added by DrKonqi

kdevelop (4.3.1) on KDE Platform 4.8.3 (4.8.3) using Qt 4.8.2

Seeing almost certainly the same problem here... backtrace is very similar, and likewise happened when I switched between my project's 'master' and 'next' git branches.

-- Backtrace (Reduced):
#6  0x00000030fea35965 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#7  0x00000030fea37118 in __GI_abort () at abort.c:91
[...]
#9  0x00000030fea7c80e in malloc_printerr (ptr=0x7fd608671290, str=0x30feb78bf8 "double free or corruption (fasttop)", action=3) at malloc.c:5027
#10 _int_free (av=0x7fd608000020, p=0x7fd608671280, have_lock=0) at malloc.c:3948
#11 0x00000038988c4ee8 in QString::free (d=0x7fd608671290) at tools/qstring.cpp:1235
Comment 3 Milian Wolff 2012-08-06 14:25:27 UTC
*** Bug 303542 has been marked as a duplicate of this bug. ***
Comment 4 Aleix Pol 2012-08-06 16:51:28 UTC
Created attachment 72990 [details]
attempt

Can somebody test it and tell me if this patch solves the crash?

I can't reproduce it by changing kdelibs from 4.2 to 4.9 back and forth, but you know, it never crashes to me but then it explodes on others...
Comment 5 Ivan Shapovalov 2012-08-07 07:43:33 UTC
With given patch KDevelop doesn't crash anymore, but project reparse isn't also triggered when you edit CMake files/invoke configure... Is this intended?
Comment 6 Aleix Pol 2012-08-07 10:18:08 UTC
Well... here the tree is reloaded, I think.
I'll look into this, but I think it works.
Comment 7 Ivan Shapovalov 2012-08-07 14:50:06 UTC
At least the patch makes KDevelop to call configure job before each other job (build, clean, install) even though nothing has been changed... So it should be wrong somewhere.
Comment 8 Aleix Pol 2012-08-07 15:04:14 UTC
Well that's maybe because of some changes in kdevelop master, it's definitely not something in the patch.
If you have problems with that please open a bug report about it and I'll haunt it later.
Comment 9 Ivan Shapovalov 2012-08-07 15:28:33 UTC
Ah, you're actually right. That's in master.
Comment 10 Aleix Pol 2012-08-21 02:16:43 UTC
Git commit 2ed699509495bf84a153e8dab625c4620a0437ae by Aleix Pol.
Committed on 21/08/2012 at 04:02.
Pushed by apol into branch '4.4'.

Fix threading problem in the CMakeManager

Not only delete the model items from the UI thread but also remove
them from the model.

M  +17   -11   projectmanagers/cmake/cmakemanager.cpp

http://commits.kde.org/kdevelop/2ed699509495bf84a153e8dab625c4620a0437ae
Comment 11 Milian Wolff 2012-10-04 22:55:59 UTC
*** Bug 307177 has been marked as a duplicate of this bug. ***
Comment 12 Milian Wolff 2012-10-04 22:57:30 UTC
Reopening, this is still broken as-is. Adding stuff to the model is also thread-unsafe and still done as far as I can see (e.g. in CMakeManager::parse).
Comment 13 Aleix Pol 2012-10-28 18:31:44 UTC
*** Bug 273418 has been marked as a duplicate of this bug. ***
Comment 14 Aleix Pol 2012-10-28 18:59:02 UTC
*** Bug 286207 has been marked as a duplicate of this bug. ***
Comment 15 Techwolf 2012-12-01 02:43:02 UTC
Created attachment 75558 [details]
New crash information added by DrKonqi

kdevelop (4.4.1) on KDE Platform 4.9.3 using Qt 4.8.3

In a seperate console, I did a hg pull. That is it. I did have some files open on the project, but no un-saved edits.

-- Backtrace (Reduced):
#9  0x00007fe0a7fa90f5 in malloc_printerr (action=3, str=0x7fe0a8098d20 "double free or corruption (fasttop)", ptr=<optimized out>) at malloc.c:4949
#10 0x00007fe0a939eb10 in QString::free (d=0x7fdfe0538860) at tools/qstring.cpp:1235
#11 0x00007fe0a5c30077 in KDevelop::ProjectBaseItem::lessThan (this=<optimized out>, item=<optimized out>) at /var/tmp/portage/dev-util/kdevplatform-1.4.1/work/kdevplatform-1.4.1/project/projectmodel.cpp:378
#12 0x00007fe0a8d8dbf0 in QSortFilterProxyModelPrivate::proxy_intervals_for_source_items_to_add (this=0x86de4d0, proxy_to_source=..., source_items=..., source_parent=..., orient=<optimized out>) at itemviews/qsortfilterproxymodel.cpp:614
#13 0x00007fe0a8d8dfc3 in QSortFilterProxyModelPrivate::insert_source_items (this=<optimized out>, source_to_proxy=..., proxy_to_source=..., source_items=..., source_parent=..., orient=<optimized out>, emit_signal=false) at itemviews/qsortfilterproxymodel.cpp:673
Comment 16 Valentin Rusu 2012-12-12 13:36:01 UTC
Created attachment 75799 [details]
New crash information added by DrKonqi

kdevelop (4.4.60) on KDE Platform 4.9.80 using Qt 4.8.4

- What I was doing when the application crashed:

I just updated kdelibs-frameworks sources from an external terminal, with them loaded in KDevelop.

-- Backtrace (Reduced):
#10 0x00007f4e4d730168 in QString::free(QString::Data*) () from /usr/lib/libQtCore.so.4
#11 0x00007f4e49f629ca in ~QString (this=<optimized out>, __in_chrg=<optimized out>) at /usr/include/QtCore/qstring.h:880
#12 lessThan (item=0x7f4d0c047e50, this=0x7f4d0d300450) at /home/kde/src/extragear/kdevelop/kdevplatform/project/projectmodel.cpp:394
#13 KDevelop::ProjectBaseItem::lessThan (this=0x7f4d0d300450, item=0x7f4d0c047e50) at /home/kde/src/extragear/kdevelop/kdevplatform/project/projectmodel.cpp:380
[...]
#17 0x00007f4e4d7f806e in QObject::event(QEvent*) () from /usr/lib/libQtCore.so.4
Comment 17 Milian Wolff 2012-12-22 18:50:22 UTC
*** Bug 312040 has been marked as a duplicate of this bug. ***
Comment 18 Matthew Woehlke 2013-01-01 20:40:50 UTC
Created attachment 76129 [details]
New crash information added by DrKonqi

kdevelop (4.4.1) on KDE Platform 4.9.4 using Qt 4.8.4

- What I was doing when the application crashed:
Was adding a new add_subdirectory to a CMakeLists.txt, when KDevelop went piff. Suspect I've seen the same crash at least one other time also, again while editing a CMakeLists.txt.

-- Backtrace (Reduced):
#6  0x00000039a5835935 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#7  0x00000039a58370e8 in __GI_abort () at abort.c:91
[...]
#9  0x00000039a587c00e in malloc_printerr (ptr=0x7f4784939b50, str=0x39a5978958 "double free or corruption (fasttop)", action=3) at malloc.c:5027
#10 _int_free (av=0x7f4784000020, p=0x7f4784939b40, have_lock=0) at malloc.c:3948
#11 0x000000345e4c5298 in QString::free (d=0x7f4784939b50) at tools/qstring.cpp:1235
Comment 19 Milian Wolff 2013-01-13 18:48:55 UTC
*** Bug 284460 has been marked as a duplicate of this bug. ***
Comment 20 Aleix Pol 2013-02-27 18:15:03 UTC
*** Bug 303281 has been marked as a duplicate of this bug. ***
Comment 21 Aleix Pol 2013-02-27 18:42:46 UTC
*** Bug 297119 has been marked as a duplicate of this bug. ***
Comment 22 Aleix Pol 2013-03-18 12:16:03 UTC
*** Bug 316703 has been marked as a duplicate of this bug. ***
Comment 23 Aleix Pol 2013-05-05 10:59:25 UTC
Git commit 45cdc3badce74c28cf9bcd4168dd2c1f186dd0f3 by Aleix Pol.
Committed on 05/05/2013 at 12:59.
Pushed by apol into branch 'master'.

Don't store a ProjectBaseItem in the MakeJob

Use a QPersistantModelIndex instead and fetch the item only when it's
needed. This way we can make sure that we don't crash if the item was
deleted during the job's life.

This is a bug fix, but I'm only committing to master for the moment.
Related: bug 319335

M  +0    -1    projectbuilders/makebuilder/makebuilder.cpp
M  +32   -25   projectbuilders/makebuilder/makejob.cpp
M  +1    -2    projectbuilders/makebuilder/makejob.h

http://commits.kde.org/kdevelop/45cdc3badce74c28cf9bcd4168dd2c1f186dd0f3
Comment 24 Aleix Pol 2013-05-08 13:21:59 UTC
Git commit 6f654f7d0e9e85b542d5f19afb1dd552e1891edb by Aleix Pol.
Committed on 05/05/2013 at 12:59.
Pushed by apol into branch '4.5'.

Don't store a ProjectBaseItem in the MakeJob

Use a QPersistantModelIndex instead and fetch the item only when it's
needed. This way we can make sure that we don't crash if the item was
deleted during the job's life.

This is a bug fix, but I'm only committing to master for the moment.
Related: bug 319335

Conflicts:
	projectbuilders/makebuilder/makejob.cpp
	projectbuilders/makebuilder/makejob.h

M  +0    -1    projectbuilders/makebuilder/makebuilder.cpp
M  +32   -26   projectbuilders/makebuilder/makejob.cpp
M  +1    -3    projectbuilders/makebuilder/makejob.h

http://commits.kde.org/kdevelop/6f654f7d0e9e85b542d5f19afb1dd552e1891edb
Comment 25 Steffen Ohrendorf 2013-06-02 03:10:12 UTC
This seems to be a race condition between ProjectBaseItem::setText() and text(), resulting in QString returning a free'd string. I tried myself on adding a mutex to the item, but only ran into deadlocks. I'm interested in fixing this, but the question is, as I am not much into the KDevelop code base, what should be made thread-save: the items, the model or both?
Comment 26 Aleix Pol 2013-06-10 18:44:09 UTC
At the moment, we should only be deleting items from the GUI thread.

Can you run it with valgrind and try to reproduce?
Comment 27 Steffen Ohrendorf 2013-06-12 03:20:48 UTC
It's not a problem of deleting an item, but of calling text() and setText() concurrently.
Comment 28 Steffen Ohrendorf 2013-06-24 01:14:33 UTC
Although I ran KDevelop a few times with valgrind, I was not able to reproduce the problem and did not see any warnings about the code dealing with the project model.
Comment 29 Aleix Pol 2013-07-18 11:37:35 UTC
*** Bug 322513 has been marked as a duplicate of this bug. ***
Comment 30 Aleix Pol 2013-09-10 02:12:47 UTC
Git commit 9d86e6f415d763f83bc183f85f5dd851e80ec95c by Aleix Pol.
Committed on 10/09/2013 at 02:07.
Pushed by apol into branch 'master'.

Merge branch 'cmakesplit'

With this change, I'm making it so the project will be parsed from
a separate thread and will pass the data to another thread that will
do the tree creation.


http://commits.kde.org/kdevelop/9d86e6f415d763f83bc183f85f5dd851e80ec95c