KDevelop::DUChainLock::lockForWrite: Tried to lock the duchain for writing, but it was already locked for reading here

Peter Oberndorfer kumbayo84 at arcor.de
Tue Oct 7 17:38:17 UTC 2008


On Montag 06 Oktober 2008, Peter Oberndorfer wrote:
> Hi,
> i get the following error with current kdevplatform/kdevelop
> KDevelop::DUChainLock::lockForWrite: Tried to lock the duchain for writing, 
> but it was already locked for reading here
> 
> how to reproduce:
> start kdevelop
> open oketa project, open about.cpp
> select OketaAboutData::OketaAboutData()
> open DUChain viewer
> double click the second Context: line
> A message box comes up that says kgraphviewer or dotty is not available
> (this messagebox is essential for the bug)
> wait some time with the messagebox open until duchain cleanup is triggered by 
> a timer.
> -> assert
> 
> A patch for kdevplatform is attached, which seems to solve this problem for 
> me.
> 
> What i do not fully understand is why there are 2
> DUChainReadLocker readLock(DUChain::lock());
> in DUChainModel::doubleClicked
> and for the above KMessageBox only the inner one of them is released?
> 
> So wouldn't it be possible that the same error happens for
> KMessageBox::error(0, i18n("Cannot create temporary file...
> since the outer lock is still locked?
> Do i misunderstand locking?
> 
To answer my own question, yes the same problem happens for the first KMessageBox.
The attached patch should fix that one too.

Changelog:
Always release the DUChain readLock before showing a KMessageBox.
Otherwise a timer could fire while the KMessageBox is open and cause problems trying to enter a writeLock.
Use only 1 DUChainReadLocker instance instead of 2.


Greetings Peter

-------------- next part --------------
A non-text attachment was scrubbed...
Name: duchainmodel_doubleclick_fix.diff
Type: text/x-diff
Size: 1657 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20081007/58bf831e/attachment.bin>


More information about the KDevelop-devel mailing list