Only initialize wxWidgets once
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28928 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -378,15 +378,19 @@ void wxPyApp::SetMacHelpMenuTitleName(const wxString& val) {
|
|||||||
// that should be present in the derived (Python) class.
|
// that should be present in the derived (Python) class.
|
||||||
void wxPyApp::_BootstrapApp()
|
void wxPyApp::_BootstrapApp()
|
||||||
{
|
{
|
||||||
bool result;
|
static bool haveInitialized = false;
|
||||||
|
bool result, blocked;
|
||||||
PyObject* retval = NULL;
|
PyObject* retval = NULL;
|
||||||
PyObject* pyint = NULL;
|
PyObject* pyint = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
// Only initialize wxWidgets once
|
||||||
|
if (! haveInitialized) {
|
||||||
|
|
||||||
// Get any command-line args passed to this program from the sys module
|
// Get any command-line args passed to this program from the sys module
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
char** argv = NULL;
|
char** argv = NULL;
|
||||||
bool blocked = wxPyBeginBlockThreads();
|
blocked = wxPyBeginBlockThreads();
|
||||||
PyObject* sysargv = PySys_GetObject("argv");
|
PyObject* sysargv = PySys_GetObject("argv");
|
||||||
if (sysargv != NULL) {
|
if (sysargv != NULL) {
|
||||||
argc = PyList_Size(sysargv);
|
argc = PyList_Size(sysargv);
|
||||||
@@ -426,10 +430,15 @@ void wxPyApp::_BootstrapApp()
|
|||||||
// SWIG generated proxies, so re-init those now...
|
// SWIG generated proxies, so re-init those now...
|
||||||
wxPy_ReinitStockObjects(3);
|
wxPy_ReinitStockObjects(3);
|
||||||
|
|
||||||
|
wxPyEndBlockThreads(blocked);
|
||||||
|
haveInitialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
// It's now ok to generate exceptions for assertion errors.
|
// It's now ok to generate exceptions for assertion errors.
|
||||||
wxPythonApp->SetStartupComplete(True);
|
wxPythonApp->SetStartupComplete(True);
|
||||||
|
|
||||||
// Call the Python wxApp's OnInit function
|
// Call the Python wxApp's OnInit function
|
||||||
|
blocked = wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "OnInit")) {
|
if (wxPyCBH_findCallback(m_myInst, "OnInit")) {
|
||||||
|
|
||||||
PyObject* method = m_myInst.GetLastFound();
|
PyObject* method = m_myInst.GetLastFound();
|
||||||
|
Reference in New Issue
Block a user