| Summary: | Crash when cancelling "Find in files" during collection stage | ||
|---|---|---|---|
| Product: | [Applications] kdevelop | Reporter: | frmdstryr <frmdstryr> |
| Component: | general | Assignee: | kdevelop-bugs-null |
| Status: | RESOLVED FIXED | ||
| Severity: | crash | CC: | chrisito, mail, rjvbertin |
| Priority: | NOR | Keywords: | drkonqi |
| Version First Reported In: | 5.3.1 | ||
| Target Milestone: | --- | ||
| Platform: | Neon | ||
| OS: | Linux | ||
| Latest Commit: | https://commits.kde.org/kdevelop/1dbebbab5f34d4b9b1ca37d5f4c1e2cd41616fd2 | Version Fixed/Implemented In: | 5.3.2 |
| Sentry Crash Report: | |||
|
Description
frmdstryr
2018-12-27 21:31:31 UTC
I couldn't reproduce this with 5.3-git on Archlinux. Specifically, what I did was: - Enter an arbitrary word for 'Pattern' - In 'Location(s)', choose a large dir (my own homedir) so the next step would take longer. - Press "Search" - While "Collecting files" is displayed in the toolview status, press "Cancel" in the main toolbar. The result was for "Failed: Search aborted" to be displayed in the status, without a crash, in several attempts with slightly different settings. Is this correct? Yes, that sounds right. I'm able to reproduce it so hopefully this helps. I have 4 projects open and it only occurs if I search and cancel on the 2nd, 3rd, and 4th projects, but not the first project. With the first project selected it correctly says "Failed: Search aborted" with any other project selected it crashes with the same trace. Also, if I don't cancel the search for projects the searches work fine. Search form is as follows: Pattern: reach Template: %s (verbatim) Replacement template: %s Reg exp: unchecked Case sensitive: checked Location(s): second selected Depth: Full Limit to project files: checked Files: *.h,*.hxx,*.hpp,*.hh,*.h++,*.H,*.tlh,*.cpp,*.cc,*.C,*.c++,*.cxx,*.ocl,*.inl,*.idl,*.c,*.m,*.mm,*.M,*.y,*.ypp,*.yxx,*.y++,*.l,*.py,*.js,*.gradle,*.java,*.css Exclude: /CVS/,/SCCS/,/.svn/,/_darcs/,/build/,/.git/,/node_modules/,/webpack_bundles/,/venv/,/php/ You should begin by installing the missing debug packages so we can see exactly where the crash occurs. I'm reminded of an intermittent crash I get after a KJob has been cancelled and somehow the code ends up using a KDevelop::Path instance that is no longer valid. With kdevplatform53-libs-dbgsym installed Thread 1 (Thread 0x7f5a244f8bc0 (LWP 29996)): [KCrash Handler] #6 0x00007f59c3b7bd17 in GrepOutputView::updateScrollArea() (this=0x556912f77e20) at ./plugins/grepview/grepoutputview.cpp:476 #7 0x00007f5a2148318f in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #8 0x00007f59c3b828af in GrepViewPlugin::grepJobFinished(bool) (this=<optimized out>, _t1=<optimized out>) at ./obj-x86_64-linux-gnu/plugins/grepview/kdevgrepview_autogen/EWIEGA46WW/moc_grepviewplugin.cpp:161 #9 0x00007f5a2148318f in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #10 0x00007f5a21b67ed9 in KJob::finished(KJob*, KJob::QPrivateSignal) () at /usr/lib/x86_64-linux-gnu/libKF5CoreAddons.so.5 #11 0x00007f5a21b68b22 in KJob::finishJob(bool) () at /usr/lib/x86_64-linux-gnu/libKF5CoreAddons.so.5 #12 0x00007f59c3b783b0 in GrepJob::slotFindFinished() (this=0x556917290c30) at ./plugins/grepview/grepjob.cpp:146 #13 0x00007f5a21483be2 in QObject::event(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #14 0x00007f5a22bb2e1c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #15 0x00007f5a22bba3ef in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #16 0x00007f5a21453fe8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #17 0x00007f5a21456b2d in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #18 0x00007f5a214ae9f3 in () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #19 0x00007f5a177c5387 in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 #20 0x00007f5a177c55c0 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 #21 0x00007f5a177c564c in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 #22 0x00007f5a214ae02f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #23 0x00007f59f2188761 in () at /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5 #24 0x00007f5a2145230a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #25 0x00007f5a2145b4d0 in QCoreApplication::exec() () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #26 0x000055690f9a1190 in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at ./app/main.cpp:849 The simplest assumption is that `model()` returns NULL and that a check against that is required as is done in other locations too. It's also conceivable (but less likely) that cancelling the search invalidates the resultsTreeView member variable (which would also cause the `model()` function to crash). I haven't been able to reproduce the symptom either, so for now the best chance to fix this would be that you build KDevelop from source with triaging patches (preferably using the Neon build script, dpkg-based I presume?). Yep that worked.
void GrepOutputView::updateScrollArea()
{
if(!model()) {
return;
}
for (int col = 0; col < model()->columnCount(); ++col)
resultsTreeView->resizeColumnToContents(col);
}
I could reproduce this by searching in the home folder with the current master of KDevelop. The check seems to be a proper fix. Would you provide a patch in phabricator which also includes a similar check in GrepOutputView::rowsRemoved()? GrepOutputView::rowsRemoved() should be safe; as that's directly connected to a signal from the model which is currently active (afaics). Added an assert. Git commit 1dbebbab5f34d4b9b1ca37d5f4c1e2cd41616fd2 by Kevin Funk. Committed on 09/01/2019 at 09:08. Pushed by kfunk into branch '5.3'. grewpview: Fix potential crash in "Find in Files" FIXED-IN: 5.3.2 M +6 -0 plugins/grepview/grepoutputview.cpp https://commits.kde.org/kdevelop/1dbebbab5f34d4b9b1ca37d5f4c1e2cd41616fd2 |