background-image: Properly clear the failed to be filled texture pointer

Otherwise we'll unref and effectively free it, eventually resulting in
use after free, causing wierd issues like crashes and infinite
recursions.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1989726
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1979>
This commit is contained in:
Jonas Ådahl 2021-08-31 09:47:59 +02:00
parent 04994ebddf
commit ef8c428ef9

View File

@ -199,8 +199,9 @@ file_loaded (GObject *source_object,
pixels, 0,
&local_error))
{
g_warning ("Failed to create texture for background");
cogl_object_unref (texture);
g_warning ("Failed to create texture for background: %s",
local_error->message);
cogl_clear_object (&texture);
}
image->texture = texture;