Search code examples
wxpython

memory leak on closing GUI


I'm developing a GUI and everything is going well, except that when I close it the following appears in my terminal and I fear that it may affect the enduser:

swig/python detected a memory leak of type 'wxWizard *', no destructor found.

How do I prevent this memory leak from happening?


Solution

  • It sounds like the wizard isn't getting closed correctly. Make sure you call the wizard's Destroy() method when you exit the wizard, regardless of whether or not the user finishes the wizard.

    You should be able to do this by catching the wizard's Finish and Cancel button events. You could also catch EVT_CLOSE and Destroy the wizard in that event handler. Please note that if you this, you will also need to call the frame's Destroy method to get the frame to close properly.