From 12aa9315d296a357780d4cd293993597897de892 2012-04-30 13:26:20 From: florianlink Date: 2012-04-30 13:26:20 Subject: [PATCH] added destructor creation for shells git-svn-id: svn://svn.code.sf.net/p/pythonqt/code/trunk@217 ea8d5007-eb21-0410-b261-ccb3ea6e24a9 --- diff --git a/generator/shellheadergenerator.cpp b/generator/shellheadergenerator.cpp index 5d2bfa1..c3d10d0 100644 --- a/generator/shellheadergenerator.cpp +++ b/generator/shellheadergenerator.cpp @@ -127,6 +127,8 @@ void ShellHeaderGenerator::write(QTextStream &s, const AbstractMetaClass *meta_c s << "),_wrapper(NULL) {};" << endl; } s << endl; + s << " ~" << shellClassName(meta_class) << "();" << endl; + s << endl; foreach(AbstractMetaFunction* fun, virtualsForShell) { s << "virtual "; diff --git a/generator/shellimplgenerator.cpp b/generator/shellimplgenerator.cpp index c942a26..394f85b 100644 --- a/generator/shellimplgenerator.cpp +++ b/generator/shellimplgenerator.cpp @@ -104,6 +104,12 @@ void ShellImplGenerator::write(QTextStream &s, const AbstractMetaClass *meta_cla } if (meta_class->generateShellClass()) { + + s << shellClassName(meta_class) << "::~" << shellClassName(meta_class) << "() {" << endl; + s << " PythonQtPrivate* priv = PythonQt::priv();" << endl; + s << " if (priv) { priv->shellClassDeleted(this); }" << endl; + s << "}" << endl; + AbstractMetaFunctionList virtualsForShell = getVirtualFunctionsForShell(meta_class); foreach (const AbstractMetaFunction *fun, virtualsForShell) { bool hasReturnValue = (fun->type());