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>
This commit is contained in:
Dmitrii Naidolinskii 2022-08-28 16:37:54 +05:00
parent f50110e8c4
commit f5754adb68

View File

@ -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);
}