From 7ce280c51c17ea3b548f60cc313773a3025450f1 2013-07-03 14:54:20 From: florianlink Date: 2013-07-03 14:54:20 Subject: [PATCH] improved wrapper check to avoid crashes on virtual methods while python object gets deleted git-svn-id: svn://svn.code.sf.net/p/pythonqt/code/trunk@245 ea8d5007-eb21-0410-b261-ccb3ea6e24a9 --- diff --git a/generator/shellimplgenerator.cpp b/generator/shellimplgenerator.cpp index 4122e4c..cbe4a82 100644 --- a/generator/shellimplgenerator.cpp +++ b/generator/shellimplgenerator.cpp @@ -124,7 +124,7 @@ void ShellImplGenerator::write(QTextStream &s, const AbstractMetaClass *meta_cla Option typeOptions = Option(OriginalName | UnderscoreSpaces | SkipName); AbstractMetaArgumentList args = fun->arguments(); - s << "if (_wrapper) {" << endl; + s << "if (_wrapper && (_wrapper->ob_refcnt > 0)) {" << endl; s << " static PyObject* name = PyString_FromString(\"" << fun->name() << "\");" << endl; s << " PyObject* obj = PyBaseObject_Type.tp_getattro((PyObject*)_wrapper, name);" << endl; s << " if (obj) {" << endl;