From b0e58a9008a01cd819d942ddc79534e8dd8ef8bd Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 1 Mar 2013 15:48:32 +0100 Subject: Fix compilation of moc generated file with MEMBER properties MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the object has only MEMBER properties, without any other property specifying READ, the generated will fail to compile with this error: tst_moc.moc: In member function ‘virtual int ClassWithOneMember::qt_metacall(QMetaObject::Call, int, void**)’: tst_moc.moc:3810:42: error: ‘_v’ was not declared in this scope That's because the '_v' is only declared if 'needTempVarForGet' is set, and it should be set when we have a MEMBER property. Change-Id: I829fad3faf69654b5a3fd540857df19f4a9449d4 Reviewed-by: Gerhard Gappmeier Reviewed-by: Simon Hausmann --- src/tools/moc/generator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/tools/moc/generator.cpp') diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index d3200ba42c..4957f7de67 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2013 Olivier Goffart ** Contact: http://www.qt-project.org/ ** ** This file is part of the tools applications of the Qt Toolkit. @@ -896,7 +897,7 @@ void Generator::generateMetacall() for (int i = 0; i < cdef->propertyList.size(); ++i) { const PropertyDef &p = cdef->propertyList.at(i); needGet |= !p.read.isEmpty() || !p.member.isEmpty(); - if (!p.read.isEmpty()) + if (!p.read.isEmpty() || !p.member.isEmpty()) needTempVarForGet |= (p.gspec != PropertyDef::PointerSpec && p.gspec != PropertyDef::ReferenceSpec); -- cgit v1.2.3