[kdevelop] [Bug 364971] New: Frequent Crash in ProblemStore::addDiagnostic due to endless recursion
https://bugs.kde.org/show_bug.cgi?id=364971 Bug ID: 364971 Summary: Frequent Crash in ProblemStore::addDiagnostic due to endless recursion Product: kdevelop Version: git master Platform: Compiled Sources OS: Linux Status: UNCONFIRMED Severity: normal Priority: NOR Component: Language Support: CPP (Clang-based) Assignee: kdevelop-bugs-n...@kde.org Reporter: david.nolden@art-master.de I'm getting this crash very frequently, but still it's hard to reproduce. This always happens when opening a certain file, and the only way to fix the problem is to delete the duchain cache. It's hard to reproduce, but my impression is, that during re-parsing, some problems and/or diagnostics are not updated properly, so that they reference the wrong problem indices as children, thus producing a recursive linkage. It may be due to the weird things that happen in LocalIndexedProblem::LocalIndexedProblem. The ideal solution would be to avoid the duplicity of the "m_diagnostics" member in KDevelop::Problem and its duchain version in ProblemData. Why not just store the child diagnostics in DUChainData as IndexProblem' And deserialize the diagnostics on-demand? Here's the backtrace: #2628 0x77af2085 in (anonymous namespace)::addDiagnostics (node=0x5ceaa30, diagnostics=...) at /home/nolden/kdedev/source/extragear/kdevelop/kdevplatform/shell/filteredproblemstore.cpp:40 #2629 0x77af2085 in (anonymous namespace)::addDiagnostics (node=0x5f1fc00, diagnostics=...) at /home/nolden/kdedev/source/extragear/kdevelop/kdevplatform/shell/filteredproblemstore.cpp:40 #2630 0x77af2085 in (anonymous namespace)::addDiagnostics (node=0x5ea9c00, diagnostics=...) at /home/nolden/kdedev/source/extragear/kdevelop/kdevplatform/shell/filteredproblemstore.cpp:40 #2631 0x77af2085 in (anonymous namespace)::addDiagnostics (node=0x5c64a90, diagnostics=...) at /home/nolden/kdedev/source/extragear/kdevelop/kdevplatform/shell/filteredproblemstore.cpp:40 #2632 0x77af2085 in (anonymous namespace)::addDiagnostics (node=0x5f1d2c0, diagnostics=...) at /home/nolden/kdedev/source/extragear/kdevelop/kdevplatform/shell/filteredproblemstore.cpp:40 #2633 0x77af2085 in (anonymous namespace)::addDiagnostics (node=0x5e8b9b0, diagnostics=...) at /home/nolden/kdedev/source/extragear/kdevelop/kdevplatform/shell/filteredproblemstore.cpp:40 #2634 0x77af2085 in (anonymous namespace)::addDiagnostics (node=0x5d6c510, diagnostics=...) at /home/nolden/kdedev/source/extragear/kdevelop/kdevplatform/shell/filteredproblemstore.cpp:40 #2635 0x77af2085 in (anonymous namespace)::addDiagnostics (node=0x5f1a560, diagnostics=...) at /home/nolden/kdedev/source/extragear/kdevelop/kdevplatform/shell/filteredproblemstore.cpp:40 #2636 0x77af2085 in (anonymous namespace)::addDiagnostics (node=0x5e87e90, diagnostics=...) at /home/nolden/kdedev/source/extragear/kdevelop/kdevplatform/shell/filteredproblemstore.cpp:40 #2637 0x77af2085 in (anonymous namespace)::addDiagnostics (node=0x5f19900, diagnostics=...) at /home/nolden/kdedev/source/extragear/kdevelop/kdevplatform/shell/filteredproblemstore.cpp:40 #2638 0x77af2085 in (anonymous namespace)::addDiagnostics (node=0x5f4a5e0, diagnostics=...) at /home/nolden/kdedev/source/extragear/kdevelop/kdevplatform/shell/filteredproblemstore.cpp:40 #2639 0x77af2085 in (anonymous namespace)::addDiagnostics (node=0x5e84790, diagnostics=...) at /home/nolden/kdedev/source/extragear/kdevelop/kdevplatform/shell/filteredproblemstore.cpp:40 #2640 0x77af2085 in (anonymous namespace)::addDiagnostics (node=0x5f16fc0, diagnostics=...) at /home/nolden/kdedev/source/extragear/kdevelop/kdevplatform/shell/filteredproblemstore.cpp:40 #2641 0x77af2085 in (anonymous namespace)::addDiagnostics (node=0x5e832f0, diagnostics=...) at /home/nolden/kdedev/source/extragear/kdevelop/kdevplatform/shell/filteredproblemstore.cpp:40 #2642 0x77af2085 in (anonymous namespace)::addDiagnostics (node=0x5e802d0, diagnostics=...) at /home/nolden/kdedev/source/extragear/kdevelop/kdevplatform/shell/filteredproblemstore.cpp:40 #2643 0x77af2085 in (anonymous namespace)::addDiagnostics (node=0x5f14260, diagnostics=...) at /home/nolden/kdedev/source/extragear/kdevelop/kdevplatform/shell/filteredproblemstore.cpp:40 #2644 0x77af2085 in (anonymous namespace)::addDiagnostics (node=0x5e7e750, diagnostics=...) at /home/nolden/kdedev/source/extragear/kdevelop/kdevplatform/shell/filteredproblemstore.cpp:40 #2645 0x77af2085 in (anonymous namespace)::addDiagnostics (node=0x5f13600, diagnostics=...) at /home/nolden/kdedev/source/extragear/kdevelop/kdevplatform/shell/filteredproblemstore.cpp:40 #2646 0x77af2085 in (anonymous namespace)::addDiagnostics (node=0x5aa4fe0, diagnostics=...) at /home/nolden/kdedev/source/extr
[kdevelop] [Bug 364971] Frequent Crash in ProblemStore::addDiagnostic due to endless recursion
https://bugs.kde.org/show_bug.cgi?id=364971 --- Comment #1 from David Nolden --- Note that I'm currently testing a patch to fix this. Until now it seems to work. I'll commit it if the bug doesn't reappear. The trick is to always re-index the child diagnostics in LocalIndexedProblem::LocalIndexedProblem(...), to ensure that the indices are current. At the moment there is some logic which avoids the re-indexing if the number of diagnostics didn't change, which is probably wrong, because the diagnostics themselves may have changed, even if their count didn't change. -- You are receiving this mail because: You are watching all bug changes.
[kdevelop] [Bug 350409] Outline widget disappears when clicking on it
https://bugs.kde.org/show_bug.cgi?id=350409 David Nolden changed: What|Removed |Added Status|CONFIRMED |RESOLVED Resolution|--- |FIXED Latest Commit||http://commits.kde.org/kdev ||platform/49d38d85fed8017067 ||8e1eaf04de36154403125e --- Comment #8 from David Nolden --- Git commit 49d38d85fed80170678e1eaf04de36154403125e by David Nolden. Committed on 02/07/2016 at 13:55. Pushed by zwabel into branch '5.0'. Fix mouse usage inside the quickopen lists. Don't hide the quickopen list on arbitrary WindowActivate or WindowDeactivate events. Call 'checkFocus' more often, and extend it so that it reliably fixes the visibility of the quickopen list by checking the globally focussed widget and window. Also make it call activateWindow in addition to setFocus, so that it reliably puts the focus back into the quick-open line edit when required. M +16 -8plugins/quickopen/quickopenplugin.cpp http://commits.kde.org/kdevplatform/49d38d85fed80170678e1eaf04de36154403125e -- You are receiving this mail because: You are watching all bug changes.
[kdevelop] [Bug 364971] Frequent Crash in ProblemStore::addDiagnostic due to endless recursion
https://bugs.kde.org/show_bug.cgi?id=364971 David Nolden changed: What|Removed |Added Latest Commit||http://commits.kde.org/kdev ||platform/5abba92236eca24126 ||a6863f1eec149693a9c4f9 Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED --- Comment #3 from David Nolden --- Git commit 5abba92236eca24126a6863f1eec149693a9c4f9 by David Nolden. Committed on 04/07/2016 at 12:12. Pushed by zwabel into branch '5.0'. Fix possible crash in ProblemStore::addDiagnostic The problem was, that child problem indices weren't updated when the number of child problems didn't change. When that happened, then child problem indices could be wrong and basically random, thus creating a recursive link which would normally be impossible. The solution is, to always re-index the children when storing the problem, no matter whether the child count changed or not. M +6-9language/duchain/problem.cpp http://commits.kde.org/kdevplatform/5abba92236eca24126a6863f1eec149693a9c4f9 -- You are receiving this mail because: You are watching all bug changes.
[kdevelop] [Bug 364971] Frequent Crash in ProblemStore::addDiagnostic due to endless recursion
https://bugs.kde.org/show_bug.cgi?id=364971 --- Comment #4 from David Nolden --- The patch was actually quite trivial, the conditional "if (static_cast(problem->m_diagnostics.size()) != problem->d_func()->diagnosticsSize())" simply needed to be removed so that indices are updated. -- You are receiving this mail because: You are watching all bug changes.
[kdevelop] [Bug 358853] New: include not found in a header causes random parsing/highlighting/code completion glitches
https://bugs.kde.org/show_bug.cgi?id=358853 Bug ID: 358853 Summary: include not found in a header causes random parsing/highlighting/code completion glitches Product: kdevelop Version: git master Platform: unspecified OS: Linux Status: UNCONFIRMED Severity: major Priority: NOR Component: Language Support: CPP (Clang-based) Assignee: kdevelop-bugs-n...@kde.org Reporter: david.nolden@art-master.de When an include is not found (even if it's not needed at all), then the semantic analysis, highlighting, code completion, etc. becomes seriously broken. It seems that clang internally just stops processing the translation-unit at some point and leaves it half-processed. Ideally this would be fixed in clang so that such situations are handled more gracefully. But before that, given how serious the implications are, KDevelop's problem reporter should at least show an error, pointing out the problem. Currently, when the #include was missing in a recursively included header, then the problem-reporter stays completely empty, leaving the user cluelessly with a half-processed document. Reproducible: Always -- You are receiving this mail because: You are watching all bug changes.
[kdevelop] [Bug 358853] include not found in a header causes random parsing/highlighting/code completion glitches
https://bugs.kde.org/show_bug.cgi?id=358853 --- Comment #2 from David Nolden --- Git commit 7bdc9e8d9539c6e904edbd021d0cc359cdc8e843 by David Nolden. Committed on 01/02/2016 at 15:53. Pushed by zwabel into branch 'master'. Add a testcase for BUG: 358853 It seems to break as soon as the second missing include is encountered. M +45 -0languages/clang/tests/test_duchain.cpp M +1-0languages/clang/tests/test_duchain.h http://commits.kde.org/kdevelop/7bdc9e8d9539c6e904edbd021d0cc359cdc8e843 -- You are receiving this mail because: You are watching all bug changes.
[kdevelop] [Bug 358853] include not found in a header causes random parsing/highlighting/code completion glitches
https://bugs.kde.org/show_bug.cgi?id=358853 --- Comment #4 from David Nolden --- Git commit a1d6a13183c01b9ea2c45e470e81f9ec53df7ada by David Nolden. Committed on 01/02/2016 at 18:11. Pushed by zwabel into branch 'master'. Always show recursive "missing include" errors in problem view Extend the missing-include test so that it becomes a recursive include and also tests this fix. The problem is only actually visible together with my previous commit to kdevplatform. M +3-1languages/clang/duchain/parsesession.cpp M +12 -7languages/clang/tests/test_duchain.cpp http://commits.kde.org/kdevelop/a1d6a13183c01b9ea2c45e470e81f9ec53df7ada -- You are receiving this mail because: You are watching all bug changes.
[kdevelop] [Bug 358853] include not found in a header causes random parsing/highlighting/code completion glitches
https://bugs.kde.org/show_bug.cgi?id=358853 --- Comment #5 from David Nolden --- Git commit c9dcbaeedef2ec746214d1be91a09293492e4abb by David Nolden. Committed on 01/02/2016 at 18:15. Pushed by zwabel into branch '5.0'. Add a testcase for BUG: 358853 It seems to break as soon as the second missing include is encountered. M +45 -0languages/clang/tests/test_duchain.cpp M +1-0languages/clang/tests/test_duchain.h http://commits.kde.org/kdevelop/c9dcbaeedef2ec746214d1be91a09293492e4abb --- Comment #6 from David Nolden --- Git commit e90e1864039d8ea3c045d64dc35d117060c950b1 by David Nolden. Committed on 01/02/2016 at 18:15. Pushed by zwabel into branch '5.0'. Always show recursive "missing include" errors in problem view Extend the missing-include test so that it becomes a recursive include and also tests this fix. The problem is only actually visible together with my previous commit to kdevplatform. M +3-1languages/clang/duchain/parsesession.cpp M +12 -7languages/clang/tests/test_duchain.cpp http://commits.kde.org/kdevelop/e90e1864039d8ea3c045d64dc35d117060c950b1 -- You are receiving this mail because: You are watching all bug changes.
[kdevelop] [Bug 358853] include not found in a header causes random parsing/highlighting/code completion glitches
https://bugs.kde.org/show_bug.cgi?id=358853 --- Comment #5 from David Nolden --- Git commit c9dcbaeedef2ec746214d1be91a09293492e4abb by David Nolden. Committed on 01/02/2016 at 18:15. Pushed by zwabel into branch '5.0'. Add a testcase for BUG: 358853 It seems to break as soon as the second missing include is encountered. M +45 -0languages/clang/tests/test_duchain.cpp M +1-0languages/clang/tests/test_duchain.h http://commits.kde.org/kdevelop/c9dcbaeedef2ec746214d1be91a09293492e4abb -- You are receiving this mail because: You are watching all bug changes.
[kdevelop] [Bug 358853] include not found in a header causes random parsing/highlighting/code completion glitches
https://bugs.kde.org/show_bug.cgi?id=358853 David Nolden changed: What|Removed |Added Resolution|--- |FIXED Status|CONFIRMED |RESOLVED Latest Commit||http://commits.kde.org/kdev ||elop/0b506dcbee4c15d4e0f193 ||08364f50cc19dcdbd2 --- Comment #7 from David Nolden --- Git commit 0b506dcbee4c15d4e0f19308364f50cc19dcdbd2 by David Nolden. Committed on 01/02/2016 at 22:13. Pushed by zwabel into branch 'master'. Workaround clang parsing problems when includes are missing When an include was missing in a parse run, then the corresponding include directive is removed from the parse using the unsaved-file mechanism, and the document is re-parsed. This is repeated until no more missing includes are found. The corresponding missing-include problems are shown in the problem-reporter anyway, so the user can fix it. M +2-0languages/clang/clangparsejob.cpp M +71 -4languages/clang/duchain/parsesession.cpp M +9-0languages/clang/duchain/parsesession.h M +11 -0languages/clang/duchain/unsavedfile.cpp M +4-0languages/clang/duchain/unsavedfile.h M +1-5languages/clang/tests/test_duchain.cpp http://commits.kde.org/kdevelop/0b506dcbee4c15d4e0f19308364f50cc19dcdbd2 -- You are receiving this mail because: You are watching all bug changes.
[kdevelop] [Bug 358853] include not found in a header causes random parsing/highlighting/code completion glitches
https://bugs.kde.org/show_bug.cgi?id=358853 David Nolden changed: What|Removed |Added Latest Commit|http://commits.kde.org/kdev |http://commits.kde.org/kdev |elop/0b506dcbee4c15d4e0f193 |elop/1dffa94f333098bca2830c |08364f50cc19dcdbd2 |9da96367156fc9b505 --- Comment #8 from David Nolden --- Git commit 1dffa94f333098bca2830c9da96367156fc9b505 by David Nolden. Committed on 03/02/2016 at 22:18. Pushed by zwabel into branch '5.0'. Workaround clang parsing problems when includes are missing When an include was missing in a parse run, then the corresponding include directive is removed from the parse using the unsaved-file mechanism, and the document is re-parsed. This is repeated until no more missing includes are found. The corresponding missing-include problems are shown in the problem-reporter anyway, so the user can fix it. M +2-0languages/clang/clangparsejob.cpp M +71 -4languages/clang/duchain/parsesession.cpp M +9-0languages/clang/duchain/parsesession.h M +11 -0languages/clang/duchain/unsavedfile.cpp M +4-0languages/clang/duchain/unsavedfile.h M +1-5languages/clang/tests/test_duchain.cpp http://commits.kde.org/kdevelop/1dffa94f333098bca2830c9da96367156fc9b505 -- You are receiving this mail because: You are watching all bug changes.