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



commit ef8c428ef90484d7a5bfc24879078963882c0a6b
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Tue Aug 31 09:47:59 2021 +0200

    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>

 src/compositor/meta-background-image.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/compositor/meta-background-image.c b/src/compositor/meta-background-image.c
index c23eef9099..1e756bd2ac 100644
--- a/src/compositor/meta-background-image.c
+++ b/src/compositor/meta-background-image.c
@@ -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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]