mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-11 06:11:27 +00:00
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
1 changed files with 6 additions and 1 deletions
|
@ -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…
Reference in a new issue