This is the mail archive of the archer@sourceware.org mailing list for the Archer project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[python] acquire GIL when removing objfile


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]