registry: fix deadlock with recursive registry scanning.
The way to properly fix this issue was in fact to disable the registry scanning when we import gst from the python plugin loader since... we are 100% guaranteed this is being called from a registry scan :)
This commit is contained in:
parent
4d8b4c8dd3
commit
bbedab4e65
@ -190,11 +190,6 @@ try:
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# disable registry update during initialization
|
|
||||||
import os
|
|
||||||
doupdate = os.getenv("GST_REGISTRY_UPDATE") != "no"
|
|
||||||
os.environ["GST_REGISTRY_UPDATE"] = "no"
|
|
||||||
|
|
||||||
from _gst import *
|
from _gst import *
|
||||||
import interfaces
|
import interfaces
|
||||||
|
|
||||||
@ -232,8 +227,3 @@ if gstlibtoolimporter is not None:
|
|||||||
gstlibtoolimporter.uninstall()
|
gstlibtoolimporter.uninstall()
|
||||||
import sys
|
import sys
|
||||||
del sys.modules["gstlibtoolimporter"]
|
del sys.modules["gstlibtoolimporter"]
|
||||||
|
|
||||||
if doupdate:
|
|
||||||
# update the registry now that we've loaded all symbols
|
|
||||||
os.unsetenv("GST_REGISTRY_UPDATE")
|
|
||||||
update_registry()
|
|
||||||
|
@ -253,6 +253,8 @@ pygst_require (gchar * version)
|
|||||||
PyObject *pygst, *gst;
|
PyObject *pygst, *gst;
|
||||||
PyObject *require;
|
PyObject *require;
|
||||||
PyObject *modules;
|
PyObject *modules;
|
||||||
|
gboolean doupdate = TRUE;
|
||||||
|
const gchar *regupd;
|
||||||
|
|
||||||
modules = PySys_GetObject ("modules");
|
modules = PySys_GetObject ("modules");
|
||||||
/* Try to see if 'gst' is already imported */
|
/* Try to see if 'gst' is already imported */
|
||||||
@ -273,12 +275,25 @@ pygst_require (gchar * version)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* We don't want the registry to be loaded when we import gst */
|
||||||
|
if ((regupd = g_getenv ("GST_REGISTRY_UPDATE"))
|
||||||
|
&& (!g_strcmp0 (regupd, "no")))
|
||||||
|
doupdate = FALSE;
|
||||||
|
g_setenv ("GST_REGISTRY_UPDATE", "no", TRUE);
|
||||||
|
|
||||||
if (!(gst = PyImport_ImportModule ("gst"))) {
|
if (!(gst = PyImport_ImportModule ("gst"))) {
|
||||||
GST_ERROR ("couldn't import the gst module");
|
GST_ERROR ("couldn't import the gst module");
|
||||||
Py_DECREF (pygst);
|
Py_DECREF (pygst);
|
||||||
|
if (doupdate)
|
||||||
|
g_unsetenv ("GST_REGISTRY_UPDATE");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (doupdate)
|
||||||
|
g_unsetenv ("GST_REGISTRY_UPDATE");
|
||||||
|
|
||||||
#define IMPORT(x, y) \
|
#define IMPORT(x, y) \
|
||||||
_PyGst##x##_Type = (PyTypeObject *)PyObject_GetAttrString(gst, y); \
|
_PyGst##x##_Type = (PyTypeObject *)PyObject_GetAttrString(gst, y); \
|
||||||
if (_PyGst##x##_Type == NULL) { \
|
if (_PyGst##x##_Type == NULL) { \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user