fix memory leak/crash in wxFrame