public:
%pythonAppend wxPyApp
- "self._setCallbackInfo(self, PyApp)
- self._setOORInfo(self)";
+ "self._setCallbackInfo(self, PyApp, False)
+ self._setOORInfo(self, False)";
%typemap(out) wxPyApp*; // turn off this typemap
DocStr(wxPyApp,
%typemap(out) wxPyApp* { $result = wxPyMake_wxObject($1, $owner); }
- void _setCallbackInfo(PyObject* self, PyObject* _class);
+ void _setCallbackInfo(PyObject* self, PyObject* _class, bool incref);
DocDeclStr(
def __del__(self):
try:
self.RestoreStdio() # Just in case the MainLoop was overridden
- except:
- pass
+ finally:
+ wx.PyApp.__del__(self)
+ def Destroy(self):
+ wx.PyApp.Destroy(self)
+ self.thisown = 0
def SetTopWindow(self, frame):
"""Set the \"main\" top level window"""
wxPyApp::~wxPyApp() {
+ wxPythonApp = NULL;
+ wxApp::SetInstance(NULL);
}
if (sysargv != NULL && executable != NULL) {
argc = PyList_Size(sysargv) + 1;
argv = new char*[argc+1];
- argv[0] = PyString_AsString(executable);
+ argv[0] = strdup(PyString_AsString(executable));
int x;
for(x=1; x<argc; x++) {
PyObject *pyArg = PyList_GetItem(sysargv, x-1);
- argv[x] = PyString_AsString(pyArg);
+ argv[x] = strdup(PyString_AsString(pyArg));
}
argv[argc] = NULL;
}
// Initialize wxWidgets
result = wxEntryStart(argc, argv);
- delete [] argv;
+ // wxApp takes ownership of the argv array, don't delete it here
blocked = wxPyBeginBlockThreads();
if (! result) {