Skip to content
Permalink
Browse files

Make version.opengl_vendor() work with an existing context

This makes it possible to use it in :debug-console
  • Loading branch information...
The-Compiler committed Jun 4, 2017
1 parent a858611 commit 4d64bcc8521e73d67c068688fd8e89b8f94433c0
Showing with 6 additions and 1 deletion.
  1. +6 −1 qutebrowser/utils/version.py
@@ -391,7 +391,9 @@ def opengl_vendor(): # pragma: no cover
from PyQt5.QtGui import (QOpenGLContext, QOpenGLVersionProfile,
QOffscreenSurface)
assert QApplication.instance()
assert QOpenGLContext.currentContext() is None

old_context = QOpenGLContext.currentContext()
old_surface = None if old_context is None else old_context.surface()

surface = QOffscreenSurface()
surface.create()
@@ -418,4 +420,7 @@ def opengl_vendor(): # pragma: no cover
vendor = vf.glGetString(vf.GL_VENDOR)
ctx.doneCurrent()

if old_context and old_surface:
old_context.makeCurrent(old_surface)

return vendor

0 comments on commit 4d64bcc

Please sign in to comment.
You can’t perform that action at this time.