[kdevelop/kdev-python] duchain: Fix DeclarationBuilder locking

Jarmo Tiitto <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 8aa0a27a759693131089a28cb6262ff711f2350f by Jarmo Tiitto.
Committed on 13/08/2026 at 18:08.
Pushed by brauch into branch 'master'.

Fix DeclarationBuilder locking

DeclarationBuilder::visitFunctionDefinition acquired a write-lock a
second time while already owning the same DUChainWriteLocker instance.

Fix this by replacing the acquire with a Q_ASSERT since the lock is
already held.

M  +2    -1    duchain/declarationbuilder.cpp

https://invent.kde.org/kdevelop/kdev-python/-/commit/8aa0a27a759693131089a28cb6262ff711f2350f

diff --git a/duchain/declarationbuilder.cpp b/duchain/declarationbuilder.cpp
index cfc2bd6b..9adf5a73 100644
--- a/duchain/declarationbuilder.cpp
+++ b/duchain/declarationbuilder.cpp
@@ -1655,7 +1655,8 @@ void DeclarationBuilder::visitFunctionDefinition( FunctionDefinitionAst* node )
         }
     }
     
-    lock.lock();
+    // DUChainWriteLocker must be held already.
+    Q_ASSERT(lock.locked());
     dec->setInSymbolTable(true);
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.