aboutsummaryrefslogtreecommitdiffstats
path: root/generator
diff options
context:
space:
mode:
Diffstat (limited to 'generator')
-rw-r--r--generator/cppgenerator.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/generator/cppgenerator.cpp b/generator/cppgenerator.cpp
index a6d810158..f2afba1d8 100644
--- a/generator/cppgenerator.cpp
+++ b/generator/cppgenerator.cpp
@@ -2767,6 +2767,11 @@ void CppGenerator::writeGetterFunction(QTextStream& s, const AbstractMetaField*
{
s << "static PyObject* " << cpythonGetterFunctionName(metaField) << "(PyObject* self, void*)" << endl;
s << '{' << endl;
+ s << INDENT << "if (!Shiboken::Object::isValid(self))\n";
+ {
+ Indentation indent(INDENT);
+ s << INDENT << "return 0;\n";
+ }
s << INDENT << "PyObject* val = ";
QString cppField;
@@ -2806,6 +2811,11 @@ void CppGenerator::writeSetterFunction(QTextStream& s, const AbstractMetaField*
{
s << "static int " << cpythonSetterFunctionName(metaField) << "(PyObject* self, PyObject* value, void*)" << endl;
s << '{' << endl;
+ s << INDENT << "if (!Shiboken::Object::isValid(self))\n";
+ {
+ Indentation indent(INDENT);
+ s << INDENT << "return 0;\n";
+ }
s << INDENT << "if (value == 0) {" << endl;
{