DUChain (?) crashes after recent updates.

Bertjan Broeksema bertjan at kdab.net
Wed Nov 25 11:11:54 UTC 2009


On Wednesday 25 November 2009 11:29:39 David Nolden wrote:
> The issue reported by Andrea Nicotra is fixed now. I actually expected such
> issues, as MMapping currently doesn't work on my system. Please report
>  further issues.

This seems to fix my crashes also.

An unrelated question, I've a method updateUrl which looks like this:

void CppQueryWidget::updateUrl(IndexedString const &url)
{
  if (mIgnoredDocuments.contains(url))
    return;

  if (!isCppFile(url)) {
    mIgnoredDocuments.insert(url);
    return;
  }

  TopDUContext::Features features = 
TopDUContext::AllDeclarationsContextsAndUses;
  features = (TopDUContext::Features) (features | TopDUContext::AST | 
TopDUContext::ForceUpdate);

  DUChainReadLocker lock(DUChain::lock());
  DUChain::self()->updateContextForUrl(IndexedString(url), features, this);
}

According to the documentation I've to provide a slot udpateReady in the this 
object. This looks like:

void CppQueryWidget::updateReady(IndexedString const &url, 
ReferencedTopDUContext const &topContext)
{
  DUChainReadLocker lock(DUChain::lock());

  if (!lock.locked()) {
    qDebug() << "LOCK FAILED";
    return;
  }

  UseQuery::Ptr query = currentQuery();
  if (!query)
    return;

  if (!topContext) {
    qDebug() << "Updating context for" << url.str() << "failed";
    return;
  }

  // dynamic_cast<ParseSession*>(mUseContext.ast().data())
  if (!topContext->ast()) {
    qDebug() << "AST not set for" << url.str();
    return;
  }

  <snip/>
}

For some reason the AST is never set on the referenced context even though I 
asked for that explicitly. Any ideas?

Cheers,

Bertjan




More information about the KDevelop-devel mailing list