mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 11:41:09 +00:00
gst: Fix a crash when passing wrong type as __templates__
This commit is contained in:
parent
8b94b967a0
commit
7b627c499d
2 changed files with 6 additions and 5 deletions
|
@ -147,7 +147,8 @@ add_templates (gpointer gclass, PyObject * templates)
|
||||||
|
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
templ = (PyGObject *) PyTuple_GetItem (templates, i);
|
templ = (PyGObject *) PyTuple_GetItem (templates, i);
|
||||||
if (GST_IS_PAD_TEMPLATE (pygobject_get (templ)) == FALSE) {
|
if (!pygobject_check (templates, &PyGObject_Type) ||
|
||||||
|
GST_IS_PAD_TEMPLATE (pygobject_get (templates)) == FALSE) {
|
||||||
PyErr_SetString (PyExc_TypeError,
|
PyErr_SetString (PyExc_TypeError,
|
||||||
"entries for __gsttemplates__ must be of type GstPadTemplate");
|
"entries for __gsttemplates__ must be of type GstPadTemplate");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -161,11 +162,11 @@ add_templates (gpointer gclass, PyObject * templates)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
} else if (!pygobject_check (templates, &PyGObject_Type) ||
|
||||||
|
GST_IS_PAD_TEMPLATE (pygobject_get (templates)) == FALSE) {
|
||||||
if (GST_IS_PAD_TEMPLATE (pygobject_get (templates)) == FALSE) {
|
|
||||||
PyErr_SetString (PyExc_TypeError,
|
PyErr_SetString (PyExc_TypeError,
|
||||||
"entry for __gsttemplates__ must be of type GstPadTemplate");
|
"entry for __gsttemplates__ must be of type GstPadTemplate");
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ import os
|
||||||
import gc
|
import gc
|
||||||
import unittest
|
import unittest
|
||||||
import gi.overrides
|
import gi.overrides
|
||||||
gi.overrides
|
|
||||||
|
|
||||||
from gi.repository import Gst
|
from gi.repository import Gst
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue