diff options
Diffstat (limited to 'languages/cpp/cppsupportpart.cpp')
-rw-r--r-- | languages/cpp/cppsupportpart.cpp | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/languages/cpp/cppsupportpart.cpp b/languages/cpp/cppsupportpart.cpp index 01b34a43..c94539de 100644 --- a/languages/cpp/cppsupportpart.cpp +++ b/languages/cpp/cppsupportpart.cpp @@ -1699,25 +1699,29 @@ void CppSupportPart::slotNeedTextHint( int line, int column, TQString& textHint return ; m_backgroundParser->lock(); - TranslationUnitAST* ast = *m_backgroundParser->translationUnit( m_activeFileName ); - AST* node = 0; - if ( ast && ( node = findNodeAt( ast, line, column ) ) ) + ParsedFilePointer pTransUnit = m_backgroundParser->translationUnit(m_activeFileName); + if (pTransUnit) { + TranslationUnitAST* ast = *pTransUnit; + AST* node = 0; + if ( ast && ( node = findNodeAt( ast, line, column ) ) ) + { - while ( node && node->nodeType() != NodeType_FunctionDefinition ) - node = node->parent(); + while ( node && node->nodeType() != NodeType_FunctionDefinition ) + node = node->parent(); - if ( node ) - { - int startLine, startColumn; - int endLine, endColumn; - node->getStartPosition( &startLine, &startColumn ); - node->getEndPosition( &endLine, &endColumn ); + if ( node ) + { + int startLine, startColumn; + int endLine, endColumn; + node->getStartPosition( &startLine, &startColumn ); + node->getEndPosition( &endLine, &endColumn ); - if ( !node->text().isNull() ) - textHint = node->text(); - else - textHint = m_activeEditor->textLine( startLine ).simplifyWhiteSpace(); + if ( !node->text().isNull() ) + textHint = node->text(); + else + textHint = m_activeEditor->textLine( startLine ).simplifyWhiteSpace(); + } } } m_backgroundParser->unlock(); |