From 5c558c00912795d7ae82c440ea7b0a790962651a Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 24 Mar 2023 11:29:38 -0400 Subject: [PATCH] Fix up criticals from GdkGLTexture I broke this in 4291f27b562f58. I overlooked that there may not be a current context. --- gdk/gdkgltexture.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gdk/gdkgltexture.c b/gdk/gdkgltexture.c index 3a9e230afe..ece45ed28c 100644 --- a/gdk/gdkgltexture.c +++ b/gdk/gdkgltexture.c @@ -320,14 +320,17 @@ static void gdk_gl_texture_determine_format (GdkGLTexture *self) { GdkTexture *texture = GDK_TEXTURE (self); + GdkGLContext *context; GLint active_texture; GLint internal_format; GLint width, height; /* Abort if somebody else is GL-ing here... */ - if (!gdk_gl_context_is_shared (self->context, gdk_gl_context_get_current ()) || + context = gdk_gl_context_get_current (); + if (context == NULL || + !gdk_gl_context_is_shared (self->context, context) || /* ... or glGetTexLevelParameter() isn't supported */ - !gdk_gl_context_check_version (gdk_gl_context_get_current (), 0, 0, 3, 1)) + !gdk_gl_context_check_version (context, 0, 0, 3, 1)) { texture->format = GDK_MEMORY_DEFAULT; self->has_mipmap = FALSE; -- 2.30.2