Index: /trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp	(revision 23629)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp	(revision 23630)
@@ -3073,7 +3073,28 @@
 }
 
+class VBoxGLContext : public QGLContext
+{
+public:
+    VBoxGLContext (const QGLFormat & format ) :
+        QGLContext(format),
+        mAllowDoneCurrent(true)
+    {
+    }
+
+    void doneCurrent()
+    {
+        if(!mAllowDoneCurrent)
+            return;
+        QGLContext::doneCurrent();
+    }
+
+    bool isDoneCurrentAllowed() { return mAllowDoneCurrent; }
+    void allowDoneCurrent(bool bAllow) { mAllowDoneCurrent = bAllow; }
+private:
+    bool mAllowDoneCurrent;
+};
 
 VBoxGLWidget::VBoxGLWidget (VBoxConsoleView *aView, QWidget *aParent)
-    : QGLWidget (VBoxGLWidget::vboxGLFormat(), aParent),
+    : QGLWidget (new VBoxGLContext(VBoxGLWidget::vboxGLFormat()), aParent),
     mSurfHandleTable(128), /* 128 should be enough */
     mpfnOp(NULL),
@@ -5282,4 +5303,8 @@
 {
     mpOverlayWidget = new VBoxGLWidget (aView, aView->viewport());
+
+    VBoxGLContext *pc = (VBoxGLContext*)mpOverlayWidget->context();
+    pc->allowDoneCurrent(false);
+
     mOverlayWidgetVisible = true; /* to ensure it is set hidden with vboxShowOverlay */
     vboxShowOverlay(false);
