From db0f9b60ac1a0f3d82cb9528ab6f0e6b902c7ec5 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Thu, 23 May 2024 17:09:38 +0800 Subject: [PATCH] gsk: Call glDeleteSync() directly This function does not use the standard __cdecl calling convention on Windows, meaning using g_clear_pointer() on it directly will cause crashes on 32-bit Windows. Just call it directly if the GLsync it uses exists. --- gsk/gpu/gskglframe.c | 5 ++++- gsk/gpu/gskgpudownloadop.c | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gsk/gpu/gskglframe.c b/gsk/gpu/gskglframe.c index d7033609d1..4d01bbf8ac 100644 --- a/gsk/gpu/gskglframe.c +++ b/gsk/gpu/gskglframe.c @@ -70,7 +70,10 @@ gsk_gl_frame_cleanup (GskGpuFrame *frame) if (self->sync) { glClientWaitSync (self->sync, 0, -1); - g_clear_pointer (&self->sync, glDeleteSync); + + /* can't use g_clear_pointer() on glDeleteSync(), see MR !7294 */ + glDeleteSync (self->sync); + self->sync = NULL; } self->next_texture_slot = 0; diff --git a/gsk/gpu/gskgpudownloadop.c b/gsk/gpu/gskgpudownloadop.c index 42597c6316..42ff54c087 100644 --- a/gsk/gpu/gskgpudownloadop.c +++ b/gsk/gpu/gskgpudownloadop.c @@ -249,7 +249,13 @@ gsk_gl_texture_data_free (gpointer user_data) gdk_gl_context_make_current (data->context); - g_clear_pointer (&data->sync, glDeleteSync); + /* can't use g_clear_pointer() on glDeleteSync(), see MR !7294 */ + if (data->sync) + { + glDeleteSync (data->sync); + data->sync = NULL; + } + glDeleteTextures (1, &data->texture_id); g_object_unref (data->context);