https://bugs.kde.org/show_bug.cgi?id=416714

Igor Kushnir <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
   Version Fixed In|                            |5.8.220401
         Resolution|---                         |FIXED
      Latest Commit|                            |https://invent.kde.org/kdev
                   |                            |elop/kdevelop/commit/a94707
                   |                            |4f0872ad3245b8c73679143998a
                   |                            |88e3753

--- Comment #7 from Igor Kushnir <[email protected]> ---
Git commit a947074f0872ad3245b8c73679143998a88e3753 by Igor Kushnir, on behalf
of Jonathan L. Verner.
Committed on 01/05/2022 at 12:56.
Pushed by igorkushnir into branch 'release/22.04'.

Fix a crash in the "update signature action".

The problem seems to be that the DUChain is readlocked in
`AbstractNavigationWidgetPrivate::anchorClicked` (see also [2]),
which then proceeds through the following (backtrace-like) call chain

  #9  AdaptSignatureAction::execute()
      (at plugins/clang/codegen/adaptsignatureaction.cpp:83)
  #10 ProblemNavigationContext::executeAction(int)
(at kdevplatform/language/duchain/navigation
problemnavigationcontext.cpp:258)
  #11 ProblemNavigationContext::executeKeyAction(QString const&)
(at
kdevplatform/language/duchain/navigation/problemnavigationcontext.cpp:243)
const&)
(at
kdevplatform/language/duchain/navigation/abstractnavigationcontext.cpp:183)
  #13 AbstractNavigationContext::acceptLink(QString const&)
(at
kdevplatform/language/duchain/navigation/abstractnavigationcontext.cpp:487)
  #14 AbstractNavigationWidgetPrivate::anchorClicked

which ends at

  plugins/clang/codegen/adaptsignatureaction.cpp:83

with an `ENSURE_CHAIN_NOT_LOCKED` macro, which asserts.

However, the lock in `anchorClicked` was added there in
commit ff72bc32 to fix bug 386901 ([1]) so it cannot
just be removed. The callchain triggering the 386901 bug looks
as follows:

  #0 FunctionDefinition::declaration
     (at kdevplatform/language/duchain/functiondefinition.cpp:52)
  #1 FunctionDefinition::declaration
     (at kdevplatform/language/duchain/functiondefinition.cpp:52)
AbstractDeclarationNavigationContext::AbstractDeclarationNavigationContext
(at
kdevplatform/language/duchain/navigation/abstractdeclarationnavigationcontext.cpp:67)
  #3 DeclarationNavigationContext::AbstractDeclarationNavigationContext
     (at plugins/clang/duchain/navigationwidget.cpp:38)
  #4 ClangNavigationWidget::ClangNavigationWidget
     (at plugins/clang/duchain/navigationwidget.cpp:98)
  #5 ClangDUContext<KDevelop::TopDUContext, 140>::createNavigationWidget
     (at plugins/clang/duchain/clangducontext.cpp:46)
  #6 AbstractNavigationContext::registerChild
(at
kdevplatform/language/duchain/navigation/abstractnavigationcontext.cpp:281)
  #7 AbstractNavigationContext::execute
(at
kdevplatform/language/duchain/navigation/abstractnavigationcontext.cpp:201)
  #8 AbstractNavigationContext::acceptLink
(at
kdevplatform/language/duchain/navigation/abstractnavigationcontext.cpp:487)
  #9 AbstractNavigationWidgetPrivate::anchorClicked
(at
kdevplatform/language/duchain/navigation/abstractnavigationwidget.cpp:285)

which hits an assert at

   kdevplatform/language/duchain/functiondefinition.cpp:52

in the `ENSURE_CAN_READ` macro.

This commit moves the lock from `anchorClicked` into
`AbstractNavigationContext::registerChild`, which is the
last opportunity for a lock before a language-plugin specific
method is called (so that the bug does not reappear in
other language plugins).

References

[1] https://bugs.kde.org/show_bug.cgi?id=386901
[2] https://phabricator.kde.org/D22182
Related: bug 358787
FIXED-IN: 5.8.220401

M  +11   -0   
kdevplatform/language/duchain/navigation/abstractnavigationcontext.cpp
M  +0    -2   
kdevplatform/language/duchain/navigation/abstractnavigationwidget.cpp

https://invent.kde.org/kdevelop/kdevelop/commit/a947074f0872ad3245b8c73679143998a88e3753

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to