mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-05 22:12:34 +00:00
plugin: call pygtk.require("2.0") before importing pygobject. Fixes #623105.
Based on a patch from Leo Singer.
This commit is contained in:
parent
84f6e26768
commit
ca020b3dd7
1 changed files with 16 additions and 1 deletions
|
@ -43,6 +43,20 @@ np_init_pygobject (void)
|
|||
PyObject *gobject = NULL;
|
||||
PyObject *main_module = NULL;
|
||||
PyObject *mdict = NULL;
|
||||
PyObject *pygtk = NULL;
|
||||
|
||||
pygtk = PyImport_ImportModule ("pygtk");
|
||||
if (pygtk == NULL) {
|
||||
PyErr_Print ();
|
||||
GST_WARNING ("could not import pygtk");
|
||||
goto beach;
|
||||
}
|
||||
|
||||
if (!(PyObject_CallMethod (pygtk, "require", "s", "2.0"))) {
|
||||
GST_WARNING ("could not run pygtk.require");
|
||||
PyErr_Print ();
|
||||
goto beach;
|
||||
}
|
||||
|
||||
gobject = PyImport_ImportModule ("gobject");
|
||||
if (gobject == NULL) {
|
||||
|
@ -54,7 +68,7 @@ np_init_pygobject (void)
|
|||
main_module = PyImport_AddModule ("__main__");
|
||||
mdict = PyModule_GetDict (gobject);
|
||||
|
||||
PyObject *cobject = PyDict_GetItemString (mdict, "_PyGObject_API");
|
||||
PyObject *cobject = PyMapping_GetItemString (mdict, "_PyGObject_API");
|
||||
if (cobject == NULL) {
|
||||
GST_WARNING ("could not find _PyGObject_API");
|
||||
goto beach;
|
||||
|
@ -77,6 +91,7 @@ np_init_pygobject (void)
|
|||
res = TRUE;
|
||||
|
||||
beach:
|
||||
Py_XDECREF (pygtk);
|
||||
Py_XDECREF (gobject);
|
||||
|
||||
return res;
|
||||
|
|
Loading…
Reference in a new issue