Index: /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.cpp
===================================================================
--- /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.cpp	(revision 76268)
+++ /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.cpp	(revision 76269)
@@ -133,5 +133,5 @@
     {
         static const char s_szLibX11[] = "libX11.so.6";
-        rc = RTLdrLoadEx(s_szLibX11, &s_hX11, RTLDRLOAD_FLAGS_GLOBAL | RTLDRLOAD_FLAGS_NO_UNLOAD, NULL);
+        rc = RTLdrLoadEx(s_szLibX11, &s_hX11, RTLDRLOAD_FLAGS_LOCAL | RTLDRLOAD_FLAGS_NO_UNLOAD, NULL);
         if (RT_FAILURE(rc))
         {
@@ -182,4 +182,25 @@
      * probably only after the release is out... */
 
+#ifdef RT_OS_WINDOWS
+    pfn_wglCreateContext = 0;
+    pfn_wglDeleteContext = 0;
+    pfn_wglMakeCurrent = 0;
+    pfn_wglShareLists = 0;
+#elif defined(RT_OS_LINUX)
+    pfn_glXQueryVersion = 0;
+    pfn_glXChooseVisual = 0;
+    pfn_glXCreateContext = 0;
+    pfn_glXMakeCurrent = 0;
+    pfn_glXDestroyContext = 0;
+    pfn_XConfigureWindow = 0;
+    pfn_XCloseDisplay = 0;
+    pfn_XCreateColormap = 0;
+    pfn_XCreateWindow = 0;
+    pfn_XDefaultRootWindow = 0;
+    pfn_XDestroyWindow = 0;
+    pfn_XNextEvent = 0;
+    pfn_XOpenDisplay = 0;
+    pfn_XPending = 0;
+#endif
     pfn_glAlphaFunc = 0;
     pfn_glBindTexture = 0;
@@ -248,27 +269,27 @@
     pfn_glVertexPointer = 0;
     pfn_glViewport = 0;
+
+    PFNRT pfnRet;
 #ifdef RT_OS_WINDOWS
-    pfn_wglCreateContext = 0;
-    pfn_wglDeleteContext = 0;
-    pfn_wglMakeCurrent = 0;
-    pfn_wglShareLists = 0;
+    GLGETPROC_(wglCreateContext, "");
+    GLGETPROC_(wglDeleteContext, "");
+    GLGETPROC_(wglMakeCurrent, "");
+    GLGETPROC_(wglShareLists, "");
 #elif defined(RT_OS_LINUX)
-    pfn_glXQueryVersion = 0;
-    pfn_glXChooseVisual = 0;
-    pfn_glXCreateContext = 0;
-    pfn_glXMakeCurrent = 0;
-    pfn_glXDestroyContext = 0;
-    pfn_XConfigureWindow = 0;
-    pfn_XCloseDisplay = 0;
-    pfn_XCreateColormap = 0;
-    pfn_XCreateWindow = 0;
-    pfn_XDefaultRootWindow = 0;
-    pfn_XDestroyWindow = 0;
-    pfn_XNextEvent = 0;
-    pfn_XOpenDisplay = 0;
-    pfn_XPending = 0;
+    X11GETPROC_(XConfigureWindow);
+    X11GETPROC_(XCloseDisplay);
+    X11GETPROC_(XCreateColormap);
+    X11GETPROC_(XCreateWindow);
+    X11GETPROC_(XDefaultRootWindow);
+    X11GETPROC_(XDestroyWindow);
+    X11GETPROC_(XNextEvent);
+    X11GETPROC_(XOpenDisplay);
+    X11GETPROC_(XPending);
+    GLGETPROC_(glXQueryVersion, "");
+    GLGETPROC_(glXChooseVisual, "");
+    GLGETPROC_(glXCreateContext, "");
+    GLGETPROC_(glXMakeCurrent, "");
+    GLGETPROC_(glXDestroyContext, "");
 #endif
-
-    PFNRT pfnRet;
     GLGETPROC_(glAlphaFunc, "");
     GLGETPROC_(glBindTexture, "");
@@ -334,25 +355,4 @@
     GLGETPROC_(glVertexPointer, "");
     GLGETPROC_(glViewport, "");
-#ifdef RT_OS_WINDOWS
-    GLGETPROC_(wglCreateContext, "");
-    GLGETPROC_(wglDeleteContext, "");
-    GLGETPROC_(wglMakeCurrent, "");
-    GLGETPROC_(wglShareLists, "");
-#elif defined(RT_OS_LINUX)
-    GLGETPROC_(glXQueryVersion, "");
-    GLGETPROC_(glXChooseVisual, "");
-    GLGETPROC_(glXCreateContext, "");
-    GLGETPROC_(glXMakeCurrent, "");
-    GLGETPROC_(glXDestroyContext, "");
-    X11GETPROC_(XConfigureWindow);
-    X11GETPROC_(XCloseDisplay);
-    X11GETPROC_(XCreateColormap);
-    X11GETPROC_(XCreateWindow);
-    X11GETPROC_(XDefaultRootWindow);
-    X11GETPROC_(XDestroyWindow);
-    X11GETPROC_(XNextEvent);
-    X11GETPROC_(XOpenDisplay);
-    X11GETPROC_(XPending);
-#endif
     return VINF_SUCCESS;
 }
Index: /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
===================================================================
--- /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp	(revision 76268)
+++ /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp	(revision 76269)
@@ -3032,17 +3032,14 @@
         /* get an X display and make sure we have glX 1.3 */
         pState->display = XOpenDisplay(0);
-        Assert(pState->display);
+        AssertLogRelMsgReturn(pState->display, ("XOpenDisplay failed"), VERR_INTERNAL_ERROR);
         int glxMajor, glxMinor;
         Bool ret = glXQueryVersion(pState->display, &glxMajor, &glxMinor);
-        AssertMsgReturn(ret && glxMajor == 1 && glxMinor >= 3, ("glX >=1.3 not present"), VERR_INTERNAL_ERROR);
+        AssertLogRelMsgReturn(ret && glxMajor == 1 && glxMinor >= 3, ("glX >=1.3 not present"), VERR_INTERNAL_ERROR);
         /* start our X event handling thread */
         rc = RTThreadCreate(&pState->pWindowThread, vmsvga3dXEventThread, pState, 0, RTTHREADTYPE_GUI, RTTHREADFLAGS_WAITABLE, "VMSVGA3DXEVENT");
-        if (RT_FAILURE(rc))
-        {
-            AssertMsgFailed(("%s: Async IO Thread creation for 3d window handling failed rc=%d\n", __FUNCTION__, rc));
-            return rc;
-        }
-    }
-
+        AssertLogRelMsgReturn(RT_SUCCESS(rc), ("Async IO Thread creation for 3d window handling failed rc=%Rrc\n", rc), rc);
+    }
+
+    Window defaultRootWindow = XDefaultRootWindow(pState->display);
     /* Create a small 4x4 window required for GL context. */
     int attrib[] =
@@ -3057,11 +3054,13 @@
     };
     XVisualInfo *vi = glXChooseVisual(pState->display, DefaultScreen(pState->display), attrib);
+    AssertLogRelMsgReturn(vi, ("glXChooseVisual failed"), VERR_INTERNAL_ERROR);
     XSetWindowAttributes swa;
-    swa.colormap = XCreateColormap(pState->display, XDefaultRootWindow(pState->display), vi->visual, AllocNone);
+    swa.colormap = XCreateColormap(pState->display, defaultRootWindow, vi->visual, AllocNone);
+    AssertLogRelMsgReturn(swa.colormap, ("XCreateColormap failed"), VERR_INTERNAL_ERROR);
     swa.border_pixel = 0;
     swa.background_pixel = 0;
     swa.event_mask = StructureNotifyMask;
     unsigned long flags = CWBorderPixel | CWBackPixel | CWColormap | CWEventMask;
-    pContext->window = XCreateWindow(pState->display, XDefaultRootWindow(pState->display),
+    pContext->window = XCreateWindow(pState->display, defaultRootWindow,
                                      0, 0, 4, 4,
                                      0, vi->depth, InputOutput,
