diff --git a/etg/dc.py b/etg/dc.py index d320d9ee..4deca2ae 100644 --- a/etg/dc.py +++ b/etg/dc.py @@ -51,6 +51,8 @@ def run(): c.addPublic() tools.removeVirtuals(c) + c.addDtor('public', True) + # Keep only the wxSize overloads of these c.find('GetSize').findOverload('wxCoord').ignore() c.find('GetSizeMM').findOverload('wxCoord').ignore() diff --git a/etgtools/extractors.py b/etgtools/extractors.py index 708edd84..78d15c4c 100644 --- a/etgtools/extractors.py +++ b/etgtools/extractors.py @@ -1072,11 +1072,12 @@ private: {CLASS}& operator=(const {CLASS}&);""".format(CLASS=self.name)) self.addItem(wig) - def addDtor(self, prot='protected'): + def addDtor(self, prot='protected', isVirtual=False): # add declaration of a destructor to this class + virtual = 'virtual ' if isVirtual else '' wig = WigCode("""\ {PROT}: - ~{CLASS}();""".format(CLASS=self.name, PROT=prot)) + {VIRTUAL}~{CLASS}();""".format(VIRTUAL=virtual, CLASS=self.name, PROT=prot)) self.addItem(wig) def addDefaultCtor(self, prot='protected'): diff --git a/unittests/test_dc.py b/unittests/test_dc.py index 466e6841..525d9694 100644 --- a/unittests/test_dc.py +++ b/unittests/test_dc.py @@ -182,9 +182,11 @@ class dc_Tests(wtc.WidgetTestCase): # check ownership assert wx.siplib.ispyowned(dc) + assert not wx.siplib.isdeleted(dc) # check the DC's ownership has changed assert not wx.siplib.ispyowned(dc) + assert wx.siplib.isdeleted(dc) #---------------------------------------------------------------------------