rhythmbox r6082 - in trunk: . plugins



Author: jmatthew
Date: Sun Nov 23 23:18:52 2008
New Revision: 6082
URL: http://svn.gnome.org/viewvc/rhythmbox?rev=6082&view=rev

Log:
2008-11-24  Jonathan Matthew  <jonathan d14n org>

	* plugins/rb-python-plugin.c: (rb_python_object_init),
	(rb_python_object_finalize):
	Acquire GIL before creating and finalizing python plugin objects.
	Should fix #544865.


Modified:
   trunk/ChangeLog
   trunk/plugins/rb-python-plugin.c

Modified: trunk/plugins/rb-python-plugin.c
==============================================================================
--- trunk/plugins/rb-python-plugin.c	(original)
+++ trunk/plugins/rb-python-plugin.c	Sun Nov 23 23:18:52 2008
@@ -194,6 +194,7 @@
 rb_python_object_init (RBPythonObject *object)
 {
 	RBPythonObjectClass *class;
+	PyGILState_STATE state = pyg_gil_state_ensure ();
 
 	rb_debug ("Creating python plugin instance");
 
@@ -202,16 +203,22 @@
 	object->instance = PyObject_CallObject (class->type, NULL);
 	if (object->instance == NULL)
 		PyErr_Print();
+	
+	pyg_gil_state_release (state);
 }
 
 static void
 rb_python_object_finalize (GObject *object)
 {
+	PyGILState_STATE state = pyg_gil_state_ensure ();
+
 	rb_debug ("Finalizing python plugin instance");
 
 	if (((RBPythonObject *) object)->instance) {
 		Py_DECREF (((RBPythonObject *) object)->instance);
 	}
+	
+	pyg_gil_state_release (state);
 
 	G_OBJECT_CLASS (parent_class)->finalize (object);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]