Summary: | Crash when repeating pgrep <search string> operation back-to-back | ||
---|---|---|---|
Product: | [Applications] kate | Reporter: | Gernot Gebhard <gg> |
Component: | search | Assignee: | KWrite Developers <kwrite-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | christoph, kare.sars, sars |
Priority: | NOR | ||
Version: | Git | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Linux | ||
Latest Commit: | https://invent.kde.org/kde/kate/commit/69c962f208ce1d608d1f66960e2a2369315ce5ed | Version Fixed In: | |
Sentry Crash Report: |
Description
Gernot Gebhard
2020-04-06 13:49:50 UTC
CC search plugin maintainer: Kåre, looks like we have some race condition. I tried to reproduce but could not.... BTW Christoph, where did you find my old email address? I have not had access to that email since 2004 ;) (In reply to Kåre Särs from comment #2) > I tried to reproduce but could not.... I just recompiled kate from scratch just to be sure and could directly reproduce the crash. To get this behavior, the pgrep operation needs still to be running. I could do this as described by typing: F7 pgrep muh ESC F7 Arrow Up Enter The last four key strokes have to be really quick! > BTW Christoph, where did you find my old email address? I have not had access to that email since 2004 ;)
:=) My browser proposed that in the bugzilla field ;=)
I was just about to ask for a crash-dump, but I can actually reproduce... My crash happens in SearchDiskFiles.cpp while calling QUrl::fromUserInput() in searchSingleLineRegExp() For some reason fileName is a Null QString, but the QFile taking that as parameter is open.... I'll investigate more... My first guess is that the file list (m_files) is cleared while we are iterating over it.... Perhaps the public SearchDiskFiles::startSearch function shall ensure that no search is still running and cancel any running one by m_cancelSearch = true; wait(); before changing the members and restarting the thread. I have now started looking into this and it is a bit complicated. I have fixed the crash, but I still have some minor annoyances that I want to iron out. Basically the "thread-safety" was built on the GUI not being enabled, but with the commands we do not have that... Git commit 54b730ac6c28d0dddac5e8c583e6ed0b3a0941fb by Kåre Särs. Committed on 02/05/2020 at 06:26. Pushed by sars into branch 'Improve--thread-safety-in-search-plugin'. Fix crash if search command is used while searching Thread safety was only provided by disabling the UI and that breaks if we use the commands. Add terminateSearch functions that stop the search without sending signals and prevent already queued signals from adding matches in the matches tree. M +11 -1 addons/search/FolderFilesList.cpp M +3 -0 addons/search/FolderFilesList.h M +17 -3 addons/search/SearchDiskFiles.cpp M +2 -0 addons/search/SearchDiskFiles.h M +27 -14 addons/search/plugin_search.cpp M +10 -8 addons/search/plugin_search.h M +11 -0 addons/search/replace_matches.cpp M +2 -0 addons/search/replace_matches.h M +27 -13 addons/search/search_open_files.cpp M +7 -3 addons/search/search_open_files.h https://invent.kde.org/kde/kate/commit/54b730ac6c28d0dddac5e8c583e6ed0b3a0941fb Git commit 69c962f208ce1d608d1f66960e2a2369315ce5ed by Kåre Särs. Committed on 06/05/2020 at 19:11. Pushed by sars into branch 'master'. Fix crash if search command is used while searching Thread safety was only provided by disabling the UI and that breaks if we use the commands. Add terminateSearch functions that stop the search without sending signals and prevent already queued signals from adding matches in the matches tree. M +11 -1 addons/search/FolderFilesList.cpp M +3 -0 addons/search/FolderFilesList.h M +17 -3 addons/search/SearchDiskFiles.cpp M +2 -0 addons/search/SearchDiskFiles.h M +27 -14 addons/search/plugin_search.cpp M +10 -8 addons/search/plugin_search.h M +11 -0 addons/search/replace_matches.cpp M +2 -0 addons/search/replace_matches.h M +27 -13 addons/search/search_open_files.cpp M +7 -3 addons/search/search_open_files.h https://invent.kde.org/kde/kate/commit/69c962f208ce1d608d1f66960e2a2369315ce5ed |