wpe: Make threaded view singleton creation thread safe
It was leading to interesting failures. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2165>
This commit is contained in:
parent
41879b20c2
commit
f9ce3946a1
@ -66,9 +66,14 @@ static WPEContextThread *s_view = NULL;
|
||||
|
||||
WPEContextThread& WPEContextThread::singleton()
|
||||
{
|
||||
if (!s_view)
|
||||
static gsize initialized = 0;
|
||||
|
||||
if (g_once_init_enter (&initialized)) {
|
||||
s_view = new WPEContextThread;
|
||||
|
||||
g_once_init_leave (&initialized, 1);
|
||||
}
|
||||
|
||||
return *s_view;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user