+#if GST_GL_HAVE_WINDOW_WIN32 && GST_GL_HAVE_PLATFORM_WGL && defined (HAVE_QT_WIN32)
+ if (!wglGetProcAddress ("wglCreateContextAttribsARB")) {
+ GstGLWindow *window;
+ HDC device;
+
+ /* If there's no wglCreateContextAttribsARB() support, then we would fallback to
+ * wglShareLists() which will fail with ERROR_BUSY (0xaa) if either of the GL
+ * contexts are current in any other thread.
+ *
+ * The workaround here is to temporarily disable Qt's GL context while we
+ * set up our own.
+ */
+ this->priv->context = gst_gl_context_new (this->priv->display);
+ window = gst_gl_context_get_window (this->priv->context);
+ device = (HDC) gst_gl_window_get_display (window);
+
+ wglMakeCurrent (device, 0);
+ gst_object_unref (window);
+ if (!gst_gl_context_create (this->priv->context, this->priv->other_context, &error)) {
+ GST_ERROR ("%p failed to create shared GL context: %s", this, error->message);
+ g_object_unref (this->priv->context);
+ this->priv->context = NULL;
+ g_object_unref (this->priv->other_context);
+ this->priv->other_context = NULL;
+ wglMakeCurrent (device, (HGLRC) gl_handle);
+ return;
+ }
+ wglMakeCurrent (device, (HGLRC) gl_handle);
+ }
+#endif