This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
[python] acquire GIL when removing objfile
- From: Tom Tromey <tromey at redhat dot com>
- To: Project Archer <archer at sourceware dot org>
- Date: Tue, 31 Mar 2009 18:22:01 -0600
- Subject: [python] acquire GIL when removing objfile
- Reply-to: tromey at redhat dot com
I'm checking this in on the python branch.
While prepping the objfile work for submission upstream, I noticed a
callback that was not acquiring the GIL.
Tom
2009-03-31 Tom Tromey <tromey@redhat.com>
* python/python-objfile.c (clean_up_objfile): Acquire and release
GIL.
diff --git a/gdb/python/python-objfile.c b/gdb/python/python-objfile.c
index e97d3a2..f5db084 100644
--- a/gdb/python/python-objfile.c
+++ b/gdb/python/python-objfile.c
@@ -116,9 +116,13 @@ objfpy_set_printers (PyObject *o, PyObject *value, void *ignore)
static void
clean_up_objfile (struct objfile *objfile, void *datum)
{
+ PyGILState_STATE state;
objfile_object *object = datum;
+
+ state = PyGILState_Ensure ();
object->objfile = NULL;
Py_DECREF ((PyObject *) object);
+ PyGILState_Release (state);
}
/* Return the Python object of type Objfile representing OBJFILE. If