egl: Make sure GError gets set when we return FALSE

The convention is that when a function returns FALSE or NULL, the error
will be set. In this file we call set_egl_error but it might not set an
error. Code of the form

if (egl_do_thing (..., &error))
 use_error (error);

will crash in those cases.

This commit makes sure we always set the error even if EGL doesn't give
us an error.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3614>
This commit is contained in:
Sebastian Wick 2024-02-24 21:35:04 +01:00 committed by Marge Bot
parent a816470996
commit 46619573e0

View File

@ -158,7 +158,10 @@ set_egl_error (GError **error)
error_number = eglGetError ();
if (error_number == EGL_SUCCESS)
return;
{
g_warning ("Expected an EGL error but eglGetError returned EGL_SUCCESS");
error_number = -1;
}
error_str = get_egl_error_str (error_number);
g_set_error_literal (error, META_EGL_ERROR,