[gnome-shell] shell: Fix pixbuf reference leak saving screenshots



commit f5754adb681d55e985147b56de9c2b30c8cbc9f1
Author: Dmitrii Naidolinskii <horisontdawn yandex ru>
Date:   Sun Aug 28 16:37:54 2022 +0500

    shell: Fix pixbuf reference leak saving screenshots
    
    When saving a screenshot, the GdkPixbuf created would be left
    with a dangling reference after saving to disk (either leaked
    on errors, or via an extra reference on success). Always unref
    the pixbuf so it's either destroyed on error or there is a single
    reference fully transferred to the caller of the function.
    
    Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5501
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2449>

 src/shell-screenshot.c | 1 +
 1 file changed, 1 insertion(+)
---
diff --git a/src/shell-screenshot.c b/src/shell-screenshot.c
index fcf2da2365..c173dd5d8e 100644
--- a/src/shell-screenshot.c
+++ b/src/shell-screenshot.c
@@ -1061,6 +1061,7 @@ composite_to_stream_on_png_saved (GObject      *pixbuf,
   else
     g_task_return_pointer (task, g_object_ref (pixbuf), g_object_unref);
 
+  g_object_unref (pixbuf);
   g_object_unref (task);
 }
 


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