From 2b0da810017b03a2f8feac22cd1bf03da6ac00cc Mon Sep 17 00:00:00 2001 From: Dave Beazley Date: Thu, 31 Aug 2000 21:41:00 +0000 Subject: [PATCH] Modified C++ handling code to inherit destructors so that a derived class without a destructor can pick up a destructor (if any) from a base class. This is highly experimental---I may take it out if it breaks too much stuff. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@777 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/SWIG1.1/cplus.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Source/SWIG1.1/cplus.cxx b/Source/SWIG1.1/cplus.cxx index 3f3eae685..2f8765252 100644 --- a/Source/SWIG1.1/cplus.cxx +++ b/Source/SWIG1.1/cplus.cxx @@ -352,6 +352,19 @@ public: } } + + void inherit(int mode) { + // Set up the proper addmethods mode and provide C code (if provided) + int oldaddmethods = AddMethods; + int oldnewobject = NewObject; + AddMethods = new_method; + Clear(CCode); + Append(CCode,code); + cplus_destructor(name,iname); + AddMethods = oldaddmethods; + Clear(CCode); + } + void emit() { AddMethods = new_method; line_number = line; @@ -1191,6 +1204,7 @@ void cplus_destructor(char *name, char *iname) { CPP_destructor *d; + if (current_class->have_destructor) return; d = new CPP_destructor(name,iname); current_class->add_member(d); current_class->have_destructor = 1;