GL Renderer: Ensure that GdkGLContext is current in gsk_gl_driver_shader_weak_cb
authorLuca Bacci <luca.bacci982@gmail.com>
Sat, 27 Aug 2022 08:37:14 +0000 (10:37 +0200)
committerLuca Bacci <luca.bacci982@gmail.com>
Sat, 27 Aug 2022 11:58:17 +0000 (13:58 +0200)
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5140

gsk/gl/gskgldriver.c

index 179e870d80e0ff658f960d7d8d25bbfda749af5e..e6674fb02f297acfff0bbc2d6a8baad4b5dfa65f 100644 (file)
@@ -176,7 +176,12 @@ gsk_gl_driver_shader_weak_cb (gpointer  data,
   g_assert (GSK_IS_GL_DRIVER (self));
 
   if (self->shader_cache != NULL)
-    g_hash_table_remove (self->shader_cache, where_object_was);
+    {
+      if (self->command_queue != NULL)
+        gsk_gl_command_queue_make_current (self->command_queue);
+
+      g_hash_table_remove (self->shader_cache, where_object_was);
+    }
 }
 
 G_GNUC_NULL_TERMINATED static inline GBytes *