Commit 777a4d59 authored by Jan Schmidt's avatar Jan Schmidt

python: Fix some locking problems

Add some python pyg_begin_allow_threads/end_allow_threads when calling into some gstreamer functions that might
call into python.
parent ec692ee3
......@@ -232,7 +232,10 @@ pad_name_from_object (PyObject *object, const gchar **name)
*name = PyString_AsString (object);
return TRUE;
} else if (pygobject_check (object, &PyGstPad_Type)) {
*name = gst_object_get_name (GST_OBJECT (pygobject_get (object)));
GstObject *obj = GST_OBJECT (pygobject_get (object));
pyg_begin_allow_threads;
*name = gst_object_get_name (obj);
pyg_end_allow_threads;
return TRUE;
}
PyErr_SetString(PyExc_TypeError, "argument could not be converted to a pad");
......
......@@ -35,7 +35,13 @@ _wrap_gst_message_tp_repr (PyGstMiniObject *self)
structure_str = msg->structure ? gst_structure_to_string (msg->structure)
: g_strdup ("(none)");
src_str = msg->src ? gst_object_get_name (msg->src) : g_strdup ("(no src)");
if (msg->src) {
pyg_begin_allow_threads;
src_str = gst_object_get_name (msg->src);
pyg_end_allow_threads;
} else {
src_str = g_strdup ("(no src)");
}
repr = g_strdup_printf ("<gst.Message %s from %s at %p>",
structure_str, src_str, msg);
......
......@@ -656,24 +656,29 @@ _wrap_gst_pad_tp_repr (PyGObject *self)
gchar *elementname = NULL;
pad = GST_PAD(self->obj);
parent = GST_ELEMENT (gst_pad_get_parent (pad));
pyg_begin_allow_threads;
padname = gst_pad_get_name (pad);
parent = GST_ELEMENT (gst_pad_get_parent (pad));
if (parent)
elementname = gst_element_get_name (parent);
elementname = gst_element_get_name (parent);
buf = g_strdup_printf ("<GstPad (%s:%s) at %lx>",
parent ? elementname : "---",
padname, (long) self->obj);
g_free(padname);
if (parent) {
gst_object_unref (parent);
g_free(elementname);
g_free(elementname);
}
g_free(padname);
pyg_end_allow_threads;
retval = PyString_FromString(buf);
g_free(buf);
return retval;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment