Bug 303329

Summary: Crash on Find-Replace In Files [GrepOutputModel::doReplacements]
Product: [Applications] kdevelop Reporter: Christopher Heiny <christopherheiny>
Component: generalAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: crash CC: h.p.griffiths+bugs, kde, yaroslavkishchenko
Priority: NOR    
Version: 4.3.0   
Target Milestone: 4.3.0   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: New crash information added by DrKonqi

Description Christopher Heiny 2012-07-10 20:50:22 UTC
Application: kdevelop (4.3.0)
KDE Platform Version: 4.8.3 (4.8.3)
Qt Version: 4.8.2
Operating System: Linux 3.4.2-1.fc16.x86_64 x86_64
Distribution: "Fedora release 16 (Verne)"

-- Information about the crash:
Doing a find replace in files,  Nothing fancy - plain text replacement with no regex, and KDevelop crashes when I click the apply button.  This is 100% repeatable, and rendered Find-Replace non-functional.

This >might< be a dupe of Bug #258504, which is listed as fixed in 4.2.0.  I'm using KDevelop 4.3.0, though - so it might be a new bug rather than a regression.

-- Backtrace:
Application: KDevelop (kdevelop), signal: Segmentation fault
Using host libthread_db library "/lib64/libthread_db.so.1".
82	T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
[Current thread is 1 (Thread 0x7ff9e8a9c840 (LWP 4914))]

Thread 10 (Thread 0x7ff9db11f700 (LWP 4933)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:216
#1  0x0000003652c7c03f in wait (time=1000, this=0x2cc1dd0) at thread/qwaitcondition_unix.cpp:84
#2  QWaitCondition::wait (this=<optimized out>, mutex=0x2cad630, time=1000) at thread/qwaitcondition_unix.cpp:158
#3  0x00000036576b170b in KDevelop::DUChainPrivate::CleanupThread::run (this=0x2cad610) at /usr/src/debug/kdevplatform-1.3.0/language/duchain/duchain.cpp:282
#4  0x0000003652c7bbcb in QThreadPrivate::start (arg=0x2cad610) at thread/qthread_unix.cpp:307
#5  0x0000003648407d90 in start_thread (arg=0x7ff9db11f700) at pthread_create.c:309
#6  0x00000036478f0f5d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Thread 9 (Thread 0x7ff9c5429700 (LWP 4936)):
#0  0x00000036478e85c3 in __GI___poll (fds=<optimized out>, nfds=<optimized out>, timeout=<optimized out>) at ../sysdeps/unix/sysv/linux/poll.c:87
#1  0x000000364ac45448 in g_main_context_poll (n_fds=1, fds=0x7ff9c0002700, priority=<optimized out>, timeout=-1, context=0x7ff9c00009a0) at gmain.c:3402
#2  g_main_context_iterate (context=0x7ff9c00009a0, block=<optimized out>, dispatch=1, self=<optimized out>) at gmain.c:3084
#3  0x000000364ac4590c in g_main_context_iteration (context=0x7ff9c00009a0, may_block=1) at gmain.c:3152
#4  0x0000003652da9246 in QEventDispatcherGlib::processEvents (this=0x7ff9c00008c0, flags=<optimized out>) at kernel/qeventdispatcher_glib.cpp:426
#5  0x0000003652d79312 in QEventLoop::processEvents (this=<optimized out>, flags=...) at kernel/qeventloop.cpp:149
#6  0x0000003652d79567 in QEventLoop::exec (this=0x7ff9c5428d40, flags=...) at kernel/qeventloop.cpp:204
#7  0x0000003652c78b87 in QThread::exec (this=<optimized out>) at thread/qthread.cpp:501
#8  0x0000003652c7bbcb in QThreadPrivate::start (arg=0x3734800) at thread/qthread_unix.cpp:307
#9  0x0000003648407d90 in start_thread (arg=0x7ff9c5429700) at pthread_create.c:309
#10 0x00000036478f0f5d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Thread 8 (Thread 0x7ff9c4c28700 (LWP 4937)):
#0  0x000000364840af9d in __pthread_mutex_unlock_usercnt (mutex=<optimized out>, decr=<optimized out>) at pthread_mutex_unlock.c:53
#1  __pthread_mutex_unlock (mutex=0x7ff9b80009a8) at pthread_mutex_unlock.c:298
#2  0x000000364ac4441f in g_main_context_prepare (context=0x7ff9b80009a0, priority=0x7ff9c4c27c18) at gmain.c:2798
#3  0x000000364ac452dd in g_main_context_iterate (context=0x7ff9b80009a0, block=1, dispatch=1, self=<optimized out>) at gmain.c:3069
#4  0x000000364ac4590c in g_main_context_iteration (context=0x7ff9b80009a0, may_block=1) at gmain.c:3152
#5  0x0000003652da9246 in QEventDispatcherGlib::processEvents (this=0x7ff9b80008c0, flags=<optimized out>) at kernel/qeventdispatcher_glib.cpp:426
#6  0x0000003652d79312 in QEventLoop::processEvents (this=<optimized out>, flags=...) at kernel/qeventloop.cpp:149
#7  0x0000003652d79567 in QEventLoop::exec (this=0x7ff9c4c27d40, flags=...) at kernel/qeventloop.cpp:204
#8  0x0000003652c78b87 in QThread::exec (this=<optimized out>) at thread/qthread.cpp:501
#9  0x0000003652c7bbcb in QThreadPrivate::start (arg=0x37472f0) at thread/qthread_unix.cpp:307
#10 0x0000003648407d90 in start_thread (arg=0x7ff9c4c28700) at pthread_create.c:309
#11 0x00000036478f0f5d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Thread 7 (Thread 0x7ff9bffff700 (LWP 4942)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:165
#1  0x0000003669384db2 in QTWTF::TCMalloc_PageHeap::scavengerThread (this=0x366967e140) at ../3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp:2359
#2  0x0000003669384de9 in QTWTF::TCMalloc_PageHeap::runScavengerThread (context=<optimized out>) at ../3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp:1464
#3  0x0000003648407d90 in start_thread (arg=0x7ff9bffff700) at pthread_create.c:309
#4  0x00000036478f0f5d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Thread 6 (Thread 0x7ff9bf3ee700 (LWP 4951)):
#0  0x00000036478e85c3 in __GI___poll (fds=<optimized out>, nfds=<optimized out>, timeout=<optimized out>) at ../sysdeps/unix/sysv/linux/poll.c:87
#1  0x000000364ac45448 in g_main_context_poll (n_fds=1, fds=0x7ff9b4002200, priority=<optimized out>, timeout=-1, context=0x7ff9b40009a0) at gmain.c:3402
#2  g_main_context_iterate (context=0x7ff9b40009a0, block=<optimized out>, dispatch=1, self=<optimized out>) at gmain.c:3084
#3  0x000000364ac4590c in g_main_context_iteration (context=0x7ff9b40009a0, may_block=1) at gmain.c:3152
#4  0x0000003652da9246 in QEventDispatcherGlib::processEvents (this=0x7ff9b40008c0, flags=<optimized out>) at kernel/qeventdispatcher_glib.cpp:426
#5  0x0000003652d79312 in QEventLoop::processEvents (this=<optimized out>, flags=...) at kernel/qeventloop.cpp:149
#6  0x0000003652d79567 in QEventLoop::exec (this=0x7ff9bf3edd10, flags=...) at kernel/qeventloop.cpp:204
#7  0x0000003652c78b87 in QThread::exec (this=<optimized out>) at thread/qthread.cpp:501
#8  0x0000003652d58f9f in QInotifyFileSystemWatcherEngine::run (this=0x5826bf0) at io/qfilesystemwatcher_inotify.cpp:248
#9  0x0000003652c7bbcb in QThreadPrivate::start (arg=0x5826bf0) at thread/qthread_unix.cpp:307
#10 0x0000003648407d90 in start_thread (arg=0x7ff9bf3ee700) at pthread_create.c:309
#11 0x00000036478f0f5d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Thread 5 (Thread 0x7ff9be3ec700 (LWP 5024)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:165
#1  0x0000003652c7c0db in wait (time=18446744073709551615, this=0x1d56ec0) at thread/qwaitcondition_unix.cpp:86
#2  QWaitCondition::wait (this=<optimized out>, mutex=0x1a828e0, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:158
#3  0x000000365540aa8b in ThreadWeaver::WeaverImpl::blockThreadUntilJobsAreBeingAssigned (this=0x1d56fc0, th=0x51b3d60) at /usr/src/debug/kdelibs-4.8.3/threadweaver/Weaver/WeaverImpl.cpp:365
#4  0x000000365540d37b in ThreadWeaver::WorkingHardState::applyForWork (this=0x1b95410, th=0x51b3d60) at /usr/src/debug/kdelibs-4.8.3/threadweaver/Weaver/WorkingHardState.cpp:71
#5  0x000000365540c1ef in ThreadWeaver::ThreadRunHelper::run (this=0x7ff9be3ebd60, parent=0x1d56fc0, th=0x51b3d60) at /usr/src/debug/kdelibs-4.8.3/threadweaver/Weaver/Thread.cpp:87
#6  0x000000365540c27b in ThreadWeaver::Thread::run (this=0x51b3d60) at /usr/src/debug/kdelibs-4.8.3/threadweaver/Weaver/Thread.cpp:142
#7  0x0000003652c7bbcb in QThreadPrivate::start (arg=0x51b3d60) at thread/qthread_unix.cpp:307
#8  0x0000003648407d90 in start_thread (arg=0x7ff9be3ec700) at pthread_create.c:309
#9  0x00000036478f0f5d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Thread 4 (Thread 0x7ff9bebed700 (LWP 5025)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:165
#1  0x0000003652c7c0db in wait (time=18446744073709551615, this=0x1d56ec0) at thread/qwaitcondition_unix.cpp:86
#2  QWaitCondition::wait (this=<optimized out>, mutex=0x1a828e0, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:158
#3  0x000000365540aa8b in ThreadWeaver::WeaverImpl::blockThreadUntilJobsAreBeingAssigned (this=0x1d56fc0, th=0x7ff9b0001af0) at /usr/src/debug/kdelibs-4.8.3/threadweaver/Weaver/WeaverImpl.cpp:365
#4  0x000000365540d37b in ThreadWeaver::WorkingHardState::applyForWork (this=0x1b95410, th=0x7ff9b0001af0) at /usr/src/debug/kdelibs-4.8.3/threadweaver/Weaver/WorkingHardState.cpp:71
#5  0x000000365540c1ef in ThreadWeaver::ThreadRunHelper::run (this=0x7ff9bebecd60, parent=0x1d56fc0, th=0x7ff9b0001af0) at /usr/src/debug/kdelibs-4.8.3/threadweaver/Weaver/Thread.cpp:87
#6  0x000000365540c27b in ThreadWeaver::Thread::run (this=0x7ff9b0001af0) at /usr/src/debug/kdelibs-4.8.3/threadweaver/Weaver/Thread.cpp:142
#7  0x0000003652c7bbcb in QThreadPrivate::start (arg=0x7ff9b0001af0) at thread/qthread_unix.cpp:307
#8  0x0000003648407d90 in start_thread (arg=0x7ff9bebed700) at pthread_create.c:309
#9  0x00000036478f0f5d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Thread 3 (Thread 0x7ff9bdbeb700 (LWP 5140)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:165
#1  0x000000366e0237cc in WTF::TCMalloc_PageHeap::scavengerThread (this=0x366e9ffc40) at wtf/FastMalloc.cpp:2495
#2  0x000000366e0238f9 in WTF::TCMalloc_PageHeap::runScavengerThread (context=<optimized out>) at wtf/FastMalloc.cpp:1618
#3  0x0000003648407d90 in start_thread (arg=0x7ff9bdbeb700) at pthread_create.c:309
#4  0x00000036478f0f5d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Thread 2 (Thread 0x7ff9bd2ea700 (LWP 5141)):
#0  0x00000036478e85c3 in __GI___poll (fds=<optimized out>, nfds=<optimized out>, timeout=<optimized out>) at ../sysdeps/unix/sysv/linux/poll.c:87
#1  0x000000364ac45448 in g_main_context_poll (n_fds=1, fds=0x7ff9a40013e0, priority=<optimized out>, timeout=9963, context=0x7ff9a40009a0) at gmain.c:3402
#2  g_main_context_iterate (context=0x7ff9a40009a0, block=<optimized out>, dispatch=1, self=<optimized out>) at gmain.c:3084
#3  0x000000364ac4590c in g_main_context_iteration (context=0x7ff9a40009a0, may_block=1) at gmain.c:3152
#4  0x0000003652da9246 in QEventDispatcherGlib::processEvents (this=0x7ff9a40008c0, flags=<optimized out>) at kernel/qeventdispatcher_glib.cpp:426
#5  0x0000003652d79312 in QEventLoop::processEvents (this=<optimized out>, flags=...) at kernel/qeventloop.cpp:149
#6  0x0000003652d79567 in QEventLoop::exec (this=0x7ff9bd2e9d40, flags=...) at kernel/qeventloop.cpp:204
#7  0x0000003652c78b87 in QThread::exec (this=<optimized out>) at thread/qthread.cpp:501
#8  0x0000003652c7bbcb in QThreadPrivate::start (arg=0x1df0fe0) at thread/qthread_unix.cpp:307
#9  0x0000003648407d90 in start_thread (arg=0x7ff9bd2ea700) at pthread_create.c:309
#10 0x00000036478f0f5d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Thread 1 (Thread 0x7ff9e8a9c840 (LWP 4914)):
[KCrash Handler]
#6  rowCount (this=) at ../../src/gui/itemviews/qstandarditemmodel_p.h:101
#7  QStandardItem::rowCount (this=0x0) at itemviews/qstandarditemmodel.cpp:1413
#8  0x00007ff9d23162dc in GrepOutputModel::doReplacements (this=0x57a6cc0) at /usr/src/debug/kdevplatform-1.3.0/plugins/grepview/grepoutputmodel.cpp:425
#9  0x00007ff9d231d26a in GrepOutputView::onApply (this=0x7bde4b0) at /usr/src/debug/kdevplatform-1.3.0/plugins/grepview/grepoutputview.cpp:264
#10 0x00007ff9d230c105 in qt_static_metacall (_a=<optimized out>, _id=<optimized out>, _o=<optimized out>, _c=<optimized out>) at /usr/src/debug/kdevplatform-1.3.0/x86_64-redhat-linux-gnu/plugins/grepview/moc_grepoutputview.cpp:92
#11 GrepOutputView::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>) at /usr/src/debug/kdevplatform-1.3.0/x86_64-redhat-linux-gnu/plugins/grepview/moc_grepoutputview.cpp:76
#12 0x0000003652d8e191 in QMetaObject::activate (sender=0x7ce93b0, m=<optimized out>, local_signal_index=<optimized out>, argv=0x7fffaa3b5940) at kernel/qobject.cpp:3547
#13 0x000000365904c882 in QAbstractButton::clicked (this=<optimized out>, _t1=false) at .moc/release-shared/moc_qabstractbutton.cpp:219
#14 0x0000003658d8ed0e in QAbstractButtonPrivate::emitClicked (this=0x7c9f810) at widgets/qabstractbutton.cpp:548
#15 0x0000003658d9004b in QAbstractButtonPrivate::click (this=0x7c9f810) at widgets/qabstractbutton.cpp:541
#16 0x0000003658d902bc in QAbstractButton::mouseReleaseEvent (this=0x7ce93b0, e=0x7fffaa3b6210) at widgets/qabstractbutton.cpp:1123
#17 0x0000003658a19f4a in QWidget::event (this=0x7ce93b0, event=0x7fffaa3b6210) at kernel/qwidget.cpp:8371
#18 0x00000036589c9ae4 in notify_helper (e=0x7fffaa3b6210, receiver=0x7ce93b0, this=0x18399d0) at kernel/qapplication.cpp:4551
#19 QApplicationPrivate::notify_helper (this=0x18399d0, receiver=0x7ce93b0, e=0x7fffaa3b6210) at kernel/qapplication.cpp:4523
#20 0x00000036589cf183 in QApplication::notify (this=<optimized out>, receiver=0x7ce93b0, e=0x7fffaa3b6210) at kernel/qapplication.cpp:4094
#21 0x000000365b851ff6 in KApplication::notify (this=0x7fffaa3b70c0, receiver=0x7ce93b0, event=0x7fffaa3b6210) at /usr/src/debug/kdelibs-4.8.3/kdeui/kernel/kapplication.cpp:311
#22 0x0000003652d7a48c in QCoreApplication::notifyInternal (this=0x7fffaa3b70c0, receiver=0x7ce93b0, event=0x7fffaa3b6210) at kernel/qcoreapplication.cpp:915
#23 0x00000036589caab2 in sendEvent (event=<optimized out>, receiver=<optimized out>) at ../../src/corelib/kernel/qcoreapplication.h:231
#24 QApplicationPrivate::sendMouseEvent (receiver=0x7ce93b0, event=0x7fffaa3b6210, alienWidget=0x7ce93b0, nativeWidget=0x47206d0, buttonDown=0x7ce93b0, lastMouseReceiver=..., spontaneous=true) at kernel/qapplication.cpp:3162
#25 0x0000003658a462e5 in QETWidget::translateMouseEvent (this=0x47206d0, event=<optimized out>) at kernel/qapplication_x11.cpp:4523
#26 0x0000003658a451aa in QApplication::x11ProcessEvent (this=0x7fffaa3b70c0, event=0x7fffaa3b6ad0) at kernel/qapplication_x11.cpp:3646
#27 0x0000003658a6cb2c in x11EventSourceDispatch (s=0x183edb0, callback=0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:148
#28 0x000000364ac44f3d in g_main_dispatch (context=0x183dc00) at gmain.c:2441
#29 g_main_context_dispatch (context=0x183dc00) at gmain.c:3011
#30 0x000000364ac45738 in g_main_context_iterate (context=0x183dc00, block=<optimized out>, dispatch=1, self=<optimized out>) at gmain.c:3089
#31 0x000000364ac4590c in g_main_context_iteration (context=0x183dc00, may_block=1) at gmain.c:3152
#32 0x0000003652da91df in QEventDispatcherGlib::processEvents (this=0x1809a60, flags=<optimized out>) at kernel/qeventdispatcher_glib.cpp:424
#33 0x0000003658a6c81e in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=<optimized out>) at kernel/qguieventdispatcher_glib.cpp:207
#34 0x0000003652d79312 in QEventLoop::processEvents (this=<optimized out>, flags=...) at kernel/qeventloop.cpp:149
#35 0x0000003652d79567 in QEventLoop::exec (this=0x7fffaa3b6ea0, flags=...) at kernel/qeventloop.cpp:204
#36 0x0000003652d7e225 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1187
#37 0x000000000040a399 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/kdevelop-4.3.0/app/main.cpp:479

This bug may be a duplicate of or related to bug 258504.

Possible duplicates by query: bug 258504.

Reported using DrKonqi
Comment 1 Ярослав 2012-10-23 16:01:37 UTC
Created attachment 74758 [details]
New crash information added by DrKonqi

kdevelop (4.3.1) on KDE Platform 4.8.5 (4.8.5) using Qt 4.8.1

- What I was doing when the application crashed:

repitable crash on find-replace((((((((

-- Backtrace (Reduced):
#7  0xb67fa844 in QStandardItem::rowCount (this=0x0) at .moc/release-shared/moc_qstandarditemmodel.cpp:137
#8  0xacfc7492 in GrepOutputModel::doReplacements (this=0x95b0008) at ../../../plugins/grepview/grepoutputmodel.cpp:425
#9  0xacfcf098 in GrepOutputView::onApply (this=0x95a0bb0) at ../../../plugins/grepview/grepoutputview.cpp:264
#10 0xacfbc3c8 in qt_static_metacall (_a=0xbfc63e88, _id=10, _o=0x95a0bb0, _c=<optimized out>) at moc_grepoutputview.cpp:92
#11 GrepOutputView::qt_static_metacall (_o=0x95a0bb0, _c=QMetaObject::InvokeMetaMethod, _id=10, _a=0xbfc63e88) at moc_grepoutputview.cpp:76
Comment 2 Kevin Funk 2012-12-01 15:56:57 UTC
Easily reproducible: Do a search via Ctrl+Alt+F that will match nothing, then enter something in the replace-box and then press the 'Replace' button. I'm on it.
Comment 3 Kevin Funk 2012-12-01 20:21:14 UTC
*** Bug 308083 has been marked as a duplicate of this bug. ***
Comment 4 Kevin Funk 2012-12-02 22:44:10 UTC
*** Bug 305026 has been marked as a duplicate of this bug. ***
Comment 5 Kevin Funk 2012-12-04 22:37:49 UTC
Git commit 3b0dba91085184a1f515044ac0149937f74d066d by Kevin Funk.
Committed on 04/12/2012 at 23:36.
Pushed by kfunk into branch 'master'.

Do not crash in GrepOutputModel

In case there are no matches you can still trigger the replace.
=> Crash in GrepOutputmodel because it assumes the root item of the
model is still there.

Fixes:
* Disable the replace button in case there are no matches
* Do not crash in GrepoutModel in case the root item is invalid (call
  safety)
REVIEW: 107548

M  +5    -0    plugins/grepview/grepoutputmodel.cpp
M  +8    -2    plugins/grepview/grepoutputview.cpp

http://commits.kde.org/kdevplatform/3b0dba91085184a1f515044ac0149937f74d066d