Fixed crashes when using embedded Python interpreters.
Fixes #2101. There are 3 related changes made here: 1. Move the SWIG_globals() singleton into pyrun from pyint so it is visible to SWIG_Python_DestroyModule(). The static globals varlink has been extracted out of the function so that it can be set to NULL in SWIG_Python_DestroyModule(), which fixes the issue described in #2101. (Now when the second interpreter starts up, the Swig_Globals_global pointer will be NULL, so it knows it has to create a new one.) 2. Remove a Py_DECREF on the globals varlink. The decrement is now performed by DestroyModule(), so there's no need to do it in SWIG_init(). 3. Fixed similar issue with SWIG_Python_TypeCache().
This commit is contained in:
parent
ac9f819f6e
commit
ebe14e6e2a
3 changed files with 225 additions and 217 deletions
|
|
@ -3424,7 +3424,6 @@ public:
|
|||
Printf(f_init, "#endif\n");
|
||||
Printf(f_init, "\t }\n");
|
||||
Printf(f_init, "\t PyDict_SetItemString(md, \"%s\", globals);\n", global_name);
|
||||
Printf(f_init, "\t Py_DECREF(globals);\n");
|
||||
if (builtin)
|
||||
Printf(f_init, "\t SwigPyBuiltin_AddPublicSymbol(public_interface, \"%s\");\n", global_name);
|
||||
have_globals = 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue