fix wrong decrefs

Original commit message from CVS:
fix wrong decrefs
This commit is contained in:
Thomas Vander Stichele 2005-09-13 09:48:32 +00:00
parent 509bee5e5b
commit de0ee6f4fd
2 changed files with 50 additions and 37 deletions

View file

@ -1,3 +1,8 @@
2005-09-13 Thomas Vander Stichele <thomas at apestaart dot org>
* gst/gstbus.override:
fix wrong decrefs
2005-09-12 Thomas Vander Stichele <thomas at apestaart dot org>
* gst/gst.defs:

View file

@ -41,10 +41,13 @@ bus_sync_handler (GstBus *bus, GstMessage *message, gpointer user_data)
py_userdata = (PyObject *) user_data;
py_msg = pygstminiobject_new (GST_MINI_OBJECT (message));
callback = PyTuple_GetItem (py_userdata, 0);
/* Using N we give away our references to the args tuple */
args = Py_BuildValue ("(NN)",
pygobject_new (G_OBJECT (bus)),
py_msg);
/* add all *args to the args tuple object */
len = PyTuple_Size (py_userdata);
for (i = 1; i < len; ++i) {
PyObject *tuple = args;
@ -58,14 +61,16 @@ bus_sync_handler (GstBus *bus, GstMessage *message, gpointer user_data)
res = GST_BUS_PASS;
} else {
if (ret == Py_None) {
PyErr_SetString(PyExc_TypeError, "callback should return a BusSyncReply");
PyErr_SetString (PyExc_TypeError,
"callback should return a BusSyncReply");
PyErr_Print ();
res = GST_BUS_PASS;
} else if (pyg_enum_get_value(GST_TYPE_BUS_SYNC_REPLY, ret, (gint *) &res))
} else if (pyg_enum_get_value (GST_TYPE_BUS_SYNC_REPLY, ret,
(gint *) &res))
res = GST_BUS_PASS;
Py_DECREF (ret);
}
Py_DECREF(py_msg);
Py_DECREF (args);
pyg_gil_state_release (state);
@ -91,10 +96,13 @@ bus_handler (GstBus *bus, GstMessage *message, gpointer user_data)
py_userdata = (PyObject *) user_data;
py_msg = pygstminiobject_new (GST_MINI_OBJECT (message));
callback = PyTuple_GetItem (py_userdata, 0);
/* Using N we give away our references to the args tuple */
args = Py_BuildValue ("(NN)",
pygobject_new (G_OBJECT (bus)),
py_msg);
/* add all *args to the args tuple object */
len = PyTuple_Size (py_userdata);
for (i = 1; i < len; ++i) {
PyObject *tuple = args;
@ -108,14 +116,14 @@ bus_handler (GstBus *bus, GstMessage *message, gpointer user_data)
res = TRUE;
} else {
if (ret == Py_None) {
PyErr_SetString(PyExc_TypeError, "callback should return True or False");
PyErr_SetString (PyExc_TypeError,
"callback should return True or False");
PyErr_Print ();
res = TRUE;
} else
res = PyObject_IsTrue (ret);
Py_DECREF (ret);
}
Py_DECREF(py_msg);
Py_DECREF (args);
pyg_gil_state_release (state);