From 06bba8c7c179595bf15b1388dba915ef7f134649 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Wed, 14 Feb 2024 16:48:31 +0700 Subject: [PATCH] #3483 numpy can be imported when making gl calls not just when importing these calls.. --- xpra/client/gl/gl_check.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/xpra/client/gl/gl_check.py b/xpra/client/gl/gl_check.py index a9acc80742..5169aa6181 100755 --- a/xpra/client/gl/gl_check.py +++ b/xpra/client/gl/gl_check.py @@ -89,6 +89,11 @@ def get_max_texture_size() -> int: def check_PyOpenGL_support(force_enable) -> Dict[str,Any]: + from xpra.util import numpy_import_lock + with numpy_import_lock: + return do_check_PyOpenGL_support(force_enable) + +def do_check_PyOpenGL_support(force_enable) -> Dict[str,Any]: props : Dict[str,Any] = { "platform" : sys.platform, } @@ -110,11 +115,10 @@ def unsafe(): redirected_loggers[name] = (logger, list(logger.handlers), logger.propagate) logger.handlers = [CaptureHandler()] logger.propagate = False - with numpy_import_lock: - import OpenGL - props["pyopengl"] = OpenGL.__version__ # @UndefinedVariable - from OpenGL.GL import GL_VERSION, GL_EXTENSIONS - from OpenGL.GL import glGetString, glGetIntegerv + import OpenGL + props["pyopengl"] = OpenGL.__version__ # @UndefinedVariable + from OpenGL.GL import GL_VERSION, GL_EXTENSIONS + from OpenGL.GL import glGetString, glGetIntegerv gl_version_str = glGetString(GL_VERSION) if gl_version_str is None and not force_enable: raise_fatal_error("OpenGL version is missing - cannot continue")