X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e3dbf5934e997729c6f4f5154b1b7f29d5d22149..9c46ea66472d59fe5fe623c456e540e47d922fcf:/wxPython/src/helpers.cpp diff --git a/wxPython/src/helpers.cpp b/wxPython/src/helpers.cpp index a1be4c1611..72f84096ac 100644 --- a/wxPython/src/helpers.cpp +++ b/wxPython/src/helpers.cpp @@ -80,8 +80,11 @@ BOOL WINAPI DllMain( LPVOID lpvReserved // reserved ) { - wxSetInstance(hinstDLL); - return 1; + // If wxPython is embedded in another wxWindows app then + // the inatance has already been set. + if (! wxGetInstance()) + wxSetInstance(hinstDLL); + return TRUE; } #endif @@ -179,12 +182,12 @@ void __wxPreStart() wxPyTMutex = new wxMutex; #endif - // Bail out if there is already windows created. This means that the + // Bail out if there is already a wxApp created. This means that the // toolkit has already been initialized, as in embedding wxPython in - // a C++ wxWindows app. - if (wxTopLevelWindows.Number() > 0) + // a C++ wxWindows app, so we don't need to call wxEntryStart. + if (wxTheApp != NULL) { return; - + } wxPyDoCleanup = TRUE; int argc = 0; @@ -527,8 +530,6 @@ PyObject* wxPyConstructObject(void* ptr, PyObject* wxPyConstructObject(void* ptr, const wxString& className, int setThisOwn) { - PyObject* obj; - if (!ptr) { Py_INCREF(Py_None); return Py_None;