Commit 08e4a17a authored by Jonathan Verner's avatar Jonathan Verner Committed by Igor Kushnir
Browse files

Fix a crash when renaming a variable (in executeRenameAction)

When renaming a variable, the function `BasicRefactoring::executeRenameAction`
calls the `isValid` method of `IndexedDeclaration` which is documented to
require the DUChain to be read locked. However the function does no such
locking. This commit introduces a lock around the two calls.

BUG: 444567
FIXED-IN: 5.8.220400
parent b6a39eb4
Pipeline #109768 passed with stage
in 32 minutes and 52 seconds
......@@ -254,11 +254,16 @@ void BasicRefactoring::executeRenameAction()
auto* action = qobject_cast<QAction*>(sender());
if (action) {
IndexedDeclaration decl = action->data().value<IndexedDeclaration>();
if (!decl.isValid())
decl = declarationUnderCursor();
if (!decl.isValid())
DUChainReadLocker lock;
if (!decl.isValid())
decl = declarationUnderCursor();
if (!decl.isValid())
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment