]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/helpers.cpp
Added autoconf makefiles for FoldBar extended samples
[wxWidgets.git] / wxPython / src / helpers.cpp
index 9b7e3efb6d2ef738a5fc20f9e718f5dc58cb70ab..b5ad3f8f6b8a241c84b5ba0a24e78f4923fd6e20 100644 (file)
@@ -400,13 +400,17 @@ void wxPyApp::_BootstrapApp()
         int    argc = 0;
         char** argv = NULL;
         blocked = wxPyBeginBlockThreads();
         int    argc = 0;
         char** argv = NULL;
         blocked = wxPyBeginBlockThreads();
+        
         PyObject* sysargv = PySys_GetObject("argv");
         PyObject* sysargv = PySys_GetObject("argv");
-        if (sysargv != NULL) {
-            argc = PyList_Size(sysargv);
+        PyObject* executable = PySys_GetObject("executable");
+        
+        if (sysargv != NULL && executable != NULL) {
+            argc = PyList_Size(sysargv) + 1;
             argv = new char*[argc+1];
             argv = new char*[argc+1];
+            argv[0] = PyString_AsString(executable);
             int x;
             int x;
-            for(x=0; x<argc; x++) {
-                PyObject *pyArg = PyList_GetItem(sysargv, x);
+            for(x=1; x<argc; x++) {
+                PyObject *pyArg = PyList_GetItem(sysargv, x-1);
                 argv[x] = PyString_AsString(pyArg);
             }
             argv[argc] = NULL;
                 argv[x] = PyString_AsString(pyArg);
             }
             argv[argc] = NULL;
@@ -544,8 +548,10 @@ void __wxPyPreStart(PyObject* moduleDict)
 #endif
 
 #ifdef WXP_WITH_THREAD
 #endif
 
 #ifdef WXP_WITH_THREAD
+#if wxPyUSE_GIL_STATE
+    PyEval_InitThreads();
+#else
     PyEval_InitThreads();
     PyEval_InitThreads();
-#if !wxPyUSE_GIL_STATE
     wxPyTStates = new wxPyThreadStateArray;
     wxPyTMutex = new wxMutex;
 
     wxPyTStates = new wxPyThreadStateArray;
     wxPyTMutex = new wxMutex;