Commit 5e8755cf authored by Seungha Yang's avatar Seungha Yang

d3d11window: Protect registration/creation of WIN32 window

Querying existing window class info and creation of window object
should be protected since they are not thread safe.
parent 44cb5b4f
Pipeline #68367 passed with stages
in 76 minutes and 24 seconds
......@@ -29,6 +29,8 @@
#include <windows.h>
G_LOCK_DEFINE_STATIC (create_lock);
enum
{
PROP_0,
......@@ -411,6 +413,7 @@ _create_window (GstD3D11Window * self, GError ** error)
GST_LOG_OBJECT (self, "Attempting to create a win32 window");
G_LOCK (create_lock);
atom = GetClassInfoEx (hinstance, "GSTD3D11", &wc);
if (atom == 0) {
GST_LOG_OBJECT (self, "Register internal window class");
......@@ -428,6 +431,7 @@ _create_window (GstD3D11Window * self, GError ** error)
atom = RegisterClassEx (&wc);
if (atom == 0) {
G_UNLOCK (create_lock);
GST_ERROR_OBJECT (self, "Failed to register window class 0x%x",
(unsigned int) GetLastError ());
g_set_error (error, GST_RESOURCE_ERROR,
......@@ -450,6 +454,8 @@ _create_window (GstD3D11Window * self, GError ** error)
CW_USEDEFAULT, CW_USEDEFAULT,
0, 0, (HWND) NULL, (HMENU) NULL, hinstance, self);
G_UNLOCK (create_lock);
if (!self->internal_win_id) {
GST_ERROR_OBJECT (self, "Failed to create d3d11 window");
g_set_error (error, GST_RESOURCE_ERROR,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment