diff options
author | Paulo Alcantara <pcacjr@gmail.com> | 2012-01-18 14:23:29 -0300 |
---|---|---|
committer | Paulo Alcantara <pcacjr@gmail.com> | 2012-01-18 18:36:46 -0300 |
commit | 3aba7ebbf7ae05804d96dc1db9edad3926c89ee5 (patch) | |
tree | b2b8eb6864d8433ef6b060c24e8b077db8ce23ae /PySide/QtDeclarative/pysideqmlregistertype.cpp | |
parent | a50e42645e01662db3875e5872e84ca80ed84464 (diff) | |
download | pyside-3aba7ebbf7ae05804d96dc1db9edad3926c89ee5.tar.gz pyside-3aba7ebbf7ae05804d96dc1db9edad3926c89ee5.tar.xz pyside-3aba7ebbf7ae05804d96dc1db9edad3926c89ee5.zip |
Fix BUG #1113 - "Instantiating QObject in user-defined QML element's
constructor crashes if instantiated from QML"
Signed-off-by: Paulo Alcantara <pcacjr@gmail.com>
Reviewed-by: Marcelo Lira <marcelo.lira@openbossa.org>
Reviewed-by: Hugo Parente Lima <hugo.pl@gmail.com>
Diffstat (limited to 'PySide/QtDeclarative/pysideqmlregistertype.cpp')
-rw-r--r-- | PySide/QtDeclarative/pysideqmlregistertype.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/PySide/QtDeclarative/pysideqmlregistertype.cpp b/PySide/QtDeclarative/pysideqmlregistertype.cpp index 4efc4bf..351d917 100644 --- a/PySide/QtDeclarative/pysideqmlregistertype.cpp +++ b/PySide/QtDeclarative/pysideqmlregistertype.cpp @@ -1,7 +1,7 @@ /* * This file is part of the Shiboken Python Bindings Generator project. * - * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (C) 2010-2012 Nokia Corporation and/or its subsidiary(-ies). * * Contact: PySide team <contact@pyside.org> * @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "pysideqmlregistertype.h" @@ -58,6 +58,12 @@ static QMutex nextQmlElementMutex; template<int N> struct ElementFactoryBase { + /* Note: PySide::setNextQObjectMemoryAddr() will only be called with a NULL + * argument when the virtual address memory is to be used by any given + * specific object. The generator will take care about adding the proper + * code to handle this. (the PySide::setNextQObjectMemoryAddr() callers are + * met in the Sbk_*_init() functions. + */ static void createInto(void* memory) { QMutexLocker locker(&nextQmlElementMutex); @@ -66,7 +72,6 @@ struct ElementFactoryBase PyObject* obj = PyObject_CallObject(pyTypes[N], 0); if (!obj || PyErr_Occurred()) PyErr_Print(); - PySide::setNextQObjectMemoryAddr(0); } }; @@ -174,7 +179,7 @@ struct DeclarativeListProperty static int propListTpInit(PyObject* self, PyObject* args, PyObject* kwds) { - static const char *kwlist[] = {"type", "append", "at", "clear", "count", 0}; + static const char* kwlist[] = {"type", "append", "at", "clear", "count", 0}; PySideProperty* pySelf = reinterpret_cast<PySideProperty*>(self); DeclarativeListProperty* data = new DeclarativeListProperty; memset(data, 0, sizeof(DeclarativeListProperty)); |