* Fixed crash on file image selectors:

The global python dict can't be cleaned before the callbacks are executed.
This commit is contained in:
2003-06-14 10:10:01 +00:00
parent c812a09ff3
commit 23b2a1be8f
3 changed files with 30 additions and 14 deletions

View File

@@ -36,6 +36,10 @@
#include "Draw.h"
/* declared in ../BPY_extern.h,
* used to control global dictionary persistence: */
extern short EXPP_releaseGlobalDict;
static void Button_dealloc(PyObject *self)
{
Button *but = (Button*)self;
@@ -192,21 +196,21 @@ int BPY_spacetext_is_pywin(SpaceText *st)
static PyObject *Method_Exit (PyObject *self, PyObject *args)
{
SpaceText *st= curarea->spacedata.first;
#ifdef CLEAR_NAMESPACE
PyObject *d;
#endif
if (!PyArg_ParseTuple(args, ""))
return EXPP_ReturnPyObjError (PyExc_AttributeError,
"expected empty argument list");
exit_pydraw(st);
#ifdef CLEAR_NAMESPACE
d = st->py_globaldict; /* The current window's global namespace dictionary */
if (d) {
PyDict_Clear(d);
Py_DECREF(d); /* release dictionary */
if (EXPP_releaseGlobalDict) {
PyObject *d = st->py_globaldict;
/* d is the current window's global namespace dictionary */
if (d) {
PyDict_Clear(d);
Py_DECREF(d); /* release dictionary */
}
}
#endif
return EXPP_incr_ret (Py_None);
}