X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dd9f7fea29e3f8bb61861f52984b7943512346ac..bb56b0a828cad8b9a57dc8270a2aca42afb1903e:/wxPython/src/helpers.cpp diff --git a/wxPython/src/helpers.cpp b/wxPython/src/helpers.cpp index 160773953c..46012aa7ee 100644 --- a/wxPython/src/helpers.cpp +++ b/wxPython/src/helpers.cpp @@ -366,8 +366,16 @@ void wxPyApp::_BootstrapApp() // Call the Python wxApp's OnInit function if (wxPyCBH_findCallback(m_myInst, "OnInit")) { - retval = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); - pyint = PyNumber_Int(retval); + + PyObject* method = m_myInst.GetLastFound(); + PyObject* argTuple = PyTuple_New(0); + retval = PyEval_CallObject(method, argTuple); + Py_DECREF(argTuple); + Py_DECREF(method); + if (retval == NULL) + goto error; + + pyint = PyNumber_Int(retval); if (! pyint) { PyErr_SetString(PyExc_TypeError, "OnInit should return a boolean value"); goto error; @@ -571,7 +579,7 @@ void wxPy_ReinitStockObjects(bool init) obj = PyDict_GetItemString(wxPython_dict, dropwx(#name)); \ wxCHECK_RET(obj != NULL, wxT("Unable to find stock object for " #name)) \ wxCHECK_RET(wxPySwigInstance_Check(obj), wxT("Not a swig instance: " #name)); \ - ptrobj = wxPyMakeSwigPtr((void*)name, #classname); \ + ptrobj = wxPyMakeSwigPtr((void*)name, wxT(#classname)); \ PyObject_SetAttrString(obj, "this", ptrobj); \ Py_DECREF(ptrobj); } @@ -580,7 +588,7 @@ void wxPy_ReinitStockObjects(bool init) obj = PyDict_GetItemString(wxPython_dict, dropwx(#name)); \ wxCHECK_RET(obj != NULL, wxT("Unable to find stock object for " #name)) \ wxCHECK_RET(wxPySwigInstance_Check(obj), wxT("Not a swig instance: " #name)); \ - ptrobj = wxPyMakeSwigPtr((void*)&name, #classname); \ + ptrobj = wxPyMakeSwigPtr((void*)&name, wxT(#classname)); \ PyObject_SetAttrString(obj, "this", ptrobj); \ Py_DECREF(ptrobj); } @@ -1447,7 +1455,7 @@ int wxPyCallbackHelper::callCallback(PyObject* argTuple) const { } // Invoke the Python callable object, returning the raw PyObject return -// value. Caller should DECREF the return value and also call PyEval_SaveThread. +// value. Caller should DECREF the return value and also manage the GIL. PyObject* wxPyCallbackHelper::callCallbackObj(PyObject* argTuple) const { PyObject* result;