From cd995e0826214febb45d827c4a6410cb48eed273 Mon Sep 17 00:00:00 2001 From: Leandro Melo Date: Fri, 8 Apr 2011 12:44:05 +0200 Subject: Fix C++ model crash when evaluating deep expressions Task-number: QTCREATORBUG-3831 Done-with: Roberto Raggi --- src/shared/cplusplus/Bind.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/shared/cplusplus/Bind.cpp') diff --git a/src/shared/cplusplus/Bind.cpp b/src/shared/cplusplus/Bind.cpp index 0ca8e71ba9..a3291e400f 100644 --- a/src/shared/cplusplus/Bind.cpp +++ b/src/shared/cplusplus/Bind.cpp @@ -66,6 +66,8 @@ using namespace CPlusPlus; +const int Bind::kMaxDepth(100); + Bind::Bind(TranslationUnit *unit) : ASTVisitor(unit), _scope(0), @@ -75,7 +77,8 @@ Bind::Bind(TranslationUnit *unit) _visibility(Symbol::Public), _objcVisibility(Symbol::Public), _methodKey(Function::NormalMethod), - _skipFunctionBodies(false) + _skipFunctionBodies(false), + _depth(0) { } @@ -291,6 +294,19 @@ FullySpecifiedType Bind::postfixDeclarator(PostfixDeclaratorAST *ast, const Full return value; } +bool Bind::preVisit(AST *) +{ + ++_depth; + if (_depth > kMaxDepth) + return false; + return true; +} + +void Bind::postVisit(AST *) +{ + --_depth; +} + // AST bool Bind::visit(ObjCSelectorArgumentAST *ast) { -- cgit v1.2.1 From 839766396489249c541c60c92f717f77814dcf8b Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 13 Apr 2011 08:42:33 +0200 Subject: Update license. --- src/shared/cplusplus/Bind.cpp | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'src/shared/cplusplus/Bind.cpp') diff --git a/src/shared/cplusplus/Bind.cpp b/src/shared/cplusplus/Bind.cpp index a3291e400f..281fa67013 100644 --- a/src/shared/cplusplus/Bind.cpp +++ b/src/shared/cplusplus/Bind.cpp @@ -4,28 +4,27 @@ ** ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** GNU Lesser General Public License Usage ** -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** -- cgit v1.2.1