Run Nvidia shader workaround earlier

We need to do it before utils.opengl_vendor(), and it fits better there anyway.
This was a regression in v1.0.

See #2554, #3106
This commit is contained in:
Florian Bruhin 2017-10-14 12:10:21 +02:00
parent d411ec1eba
commit b3f395453b
2 changed files with 17 additions and 8 deletions

View File

@ -28,8 +28,6 @@ Module attributes:
"""
import os
import ctypes
import ctypes.util
from PyQt5.QtGui import QFont
from PyQt5.QtWebEngineWidgets import (QWebEngineSettings, QWebEngineProfile,
@ -231,11 +229,6 @@ def init(args):
if args.enable_webengine_inspector:
os.environ['QTWEBENGINE_REMOTE_DEBUGGING'] = str(utils.random_port())
# WORKAROUND for
# https://bugs.launchpad.net/ubuntu/+source/python-qt4/+bug/941826
if utils.is_linux:
ctypes.CDLL(ctypes.util.find_library("GL"), mode=ctypes.RTLD_GLOBAL)
_init_profiles()
# We need to do this here as a WORKAROUND for

View File

@ -23,6 +23,8 @@ import os
import sys
import functools
import html
import ctypes
import ctypes.util
import attr
from PyQt5.QtCore import Qt
@ -31,7 +33,7 @@ from PyQt5.QtWidgets import (QApplication, QDialog, QPushButton, QHBoxLayout,
from PyQt5.QtNetwork import QSslSocket
from qutebrowser.config import config
from qutebrowser.utils import usertypes, objreg, version, qtutils, log
from qutebrowser.utils import usertypes, objreg, version, qtutils, log, utils
from qutebrowser.misc import objects, msgbox
@ -154,6 +156,19 @@ def _show_dialog(*args, **kwargs):
sys.exit(usertypes.Exit.err_init)
def _nvidia_shader_workaround():
"""Work around QOpenGLShaderProgram issues.
NOTE: This needs to be called before _handle_nouveau_graphics, or some
setups will segfault in version.opengl_vendor().
See https://bugs.launchpad.net/ubuntu/+source/python-qt4/+bug/941826
"""
assert objects.backend == usertypes.Backend.QtWebEngine, objects.backend
if utils.is_linux:
ctypes.CDLL(ctypes.util.find_library("GL"), mode=ctypes.RTLD_GLOBAL)
def _handle_nouveau_graphics():
assert objects.backend == usertypes.Backend.QtWebEngine, objects.backend
@ -352,6 +367,7 @@ def init():
if objects.backend == usertypes.Backend.QtWebEngine:
_handle_ssl_support()
_handle_wayland()
_nvidia_shader_workaround()
_handle_nouveau_graphics()
else:
assert objects.backend == usertypes.Backend.QtWebKit, objects.backend