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());