Bug 1267879 - Fix WGL robustness. - r=jrmuizel
authorJeff Gilbert <jgilbert@mozilla.com>
Fri, 10 Jun 2016 17:44:15 -0700
changeset 383234 bba7d02cdb8c475d04f078ef004fd6e6fcfa7fcd
parent 383233 99a891cdb4fee4c9cd54290ef4e1366e71f418de
child 383235 b2272d35d5f8bf3b43d4adcfd4e9391d7037b37a
push id21963
push userdmitchell@mozilla.com
push dateFri, 01 Jul 2016 19:54:18 +0000
reviewersjrmuizel
bugs1267879
milestone50.0a1
Bug 1267879 - Fix WGL robustness. - r=jrmuizel MozReview-Commit-ID: IpstmnnGM0N
gfx/gl/GLContextProviderWGL.cpp
--- a/gfx/gl/GLContextProviderWGL.cpp
+++ b/gfx/gl/GLContextProviderWGL.cpp
@@ -199,17 +199,17 @@ WGLLibrary::EnsureInitialized()
     };
 
     if (GLLibraryLoader::LoadSymbols(mOGLLibrary, &extensionsSymbols[0], lookupFunc))
     {
         const char* extString = fGetExtensionsString(mWindowDC);
         MOZ_ASSERT(extString);
         MOZ_ASSERT(HasExtension(extString, "WGL_ARB_extensions_string"));
 
-        if (HasExtension(extString, "WGL_ARB_context_create")) {
+        if (HasExtension(extString, "WGL_ARB_create_context")) {
             if (GLLibraryLoader::LoadSymbols(mOGLLibrary, &robustnessSymbols[0], lookupFunc)) {
                 if (HasExtension(extString, "WGL_ARB_create_context_robustness")) {
                     mHasRobustness = true;
                 }
             } else {
                 NS_ERROR("WGL supports ARB_create_context without supplying its functions.");
                 fCreateContextAttribs = nullptr;
             }
@@ -548,18 +548,18 @@ CreatePBufferOffscreenContext(CreateCont
 
     HGLRC context;
     if (wgl.HasRobustness()) {
         int attribs[] = {
             LOCAL_WGL_CONTEXT_FLAGS_ARB, LOCAL_WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB,
             LOCAL_WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB, LOCAL_WGL_LOSE_CONTEXT_ON_RESET_ARB,
             0
         };
-
-        context = wgl.fCreateContextAttribs(pbdc, aShareContext->Context(), attribs);
+        const HGLRC shareHandle = (aShareContext ? aShareContext->Context() : 0);
+        context = wgl.fCreateContextAttribs(pbdc, shareHandle, attribs);
     } else {
         context = wgl.fCreateContext(pbdc);
         if (context && aShareContext) {
             if (!wgl.fShareLists(aShareContext->Context(), context)) {
                 wgl.fDeleteContext(context);
                 context = nullptr;
                 printf_stderr("ERROR - creating pbuffer context failed because wglShareLists returned FALSE");
             }