Author: bugman Date: Thu Nov 13 12:12:35 2014 New Revision: 26563 URL: http://svn.gna.org/viewcvs/relax?rev=26563&view=rev Log: Redesigned how wizards are destroyed in the GUI. The relax wizard Destroy() method is now overridden. This allows the buttons in the wizard to be properly destroyed, as well as all wizard pages. This should remove a lot of GUI memory leaks. Modified: trunk/gui/analyses/wizard.py trunk/gui/wizards/wiz_objects.py Modified: trunk/gui/analyses/wizard.py URL: http://svn.gna.org/viewcvs/relax/trunk/gui/analyses/wizard.py?rev=26563&r1=26562&r2=26563&view=diff ============================================================================== --- trunk/gui/analyses/wizard.py (original) +++ trunk/gui/analyses/wizard.py Thu Nov 13 12:12:35 2014 @@ -56,8 +56,6 @@ def Destroy(self): """Properly delete the wizard and all its elements.""" - self.new_page.Destroy() - self.pipe_page.Destroy() self.wizard.Destroy() Modified: trunk/gui/wizards/wiz_objects.py URL: http://svn.gna.org/viewcvs/relax/trunk/gui/wizards/wiz_objects.py?rev=26563&r1=26562&r2=26563&view=diff ============================================================================== --- trunk/gui/wizards/wiz_objects.py (original) +++ trunk/gui/wizards/wiz_objects.py Thu Nov 13 12:12:35 2014 @@ -824,6 +824,26 @@ self._go_next(None) + def Destroy(self): + """Override the default wx.Dialog.Destroy() method.""" + + # Loop over each page, destroying it and all its elements to avoid memory leaks. + for i in range(self._num_pages): + # Destroy the buttons. + for name in self._buttons[i]: + if hasattr(self._buttons[i][name], 'Destroy'): + self._buttons[i][name].Destroy() + self._buttons[i][name] = None + + # Destroy each page. + if hasattr(self._pages[i], 'Destroy'): + self._pages[i].Destroy() + self._pages[i] = None + + # Call the parent method to destroy the dialog. + wx.Dialog.Destroy(self) + + def add_page(self, panel, apply_button=True, skip_button=False, exec_on_next=True, proceed_on_error=True, uf_flush=False): """Add a new page to the wizard.