7204N/AUpstream patch for gnome-shell memory leak recommended by gnome distros list
7204N/Ahttps://mail.gnome.org/archives/distributor-list/2016-March/msg00006.html
7204N/A
7204N/AFrom 4a8b9d62c98539972cf553fa8101567ce37d73c4 Mon Sep 17 00:00:00 2001
7204N/AFrom: Aaron Plattner <aplattner@nvidia.com>
7204N/ADate: Fri, 18 Mar 2016 16:00:05 -0700
7204N/ASubject: [PATCH] st: Fix offscreen leak if cogl_framebuffer_allocate fails
7204N/AX-NVConfidentiality: public
7204N/A
7204N/AIf cogl_framebuffer_allocate fails in _st_create_shadow_pipeline_from_actor, the
7204N/ACoglOffscreen* that was allocated earlier in the function is leaked.
7204N/A
7204N/Ahttps://bugzilla.gnome.org/show_bug.cgi?id=735705
7204N/A
7204N/ASigned-off-by: Aaron Plattner <aplattner@nvidia.com>
7204N/A---
7204N/A src/st/st-private.c | 1 +
7204N/A 1 file changed, 1 insertion(+)
7204N/A
7204N/Adiff --git a/src/st/st-private.c b/src/st/st-private.c
7204N/Aindex 559336c42d15..d40eceb86c78 100644
7204N/A--- a/src/st/st-private.c
7204N/A+++ b/src/st/st-private.c
7204N/A@@ -425,40 +425,41 @@ _st_create_shadow_pipeline_from_actor (StShadow *shadow_spec,
7204N/A clutter_actor_get_allocation_box (actor, &box);
7204N/A clutter_actor_box_get_size (&box, &width, &height);
7204N/A
7204N/A if (width == 0 || height == 0)
7204N/A return NULL;
7204N/A
7204N/A buffer = cogl_texture_new_with_size (width,
7204N/A height,
7204N/A COGL_TEXTURE_NO_SLICING,
7204N/A COGL_PIXEL_FORMAT_ANY);
7204N/A
7204N/A if (buffer == NULL)
7204N/A return NULL;
7204N/A
7204N/A offscreen = cogl_offscreen_new_with_texture (buffer);
7204N/A fb = COGL_FRAMEBUFFER (offscreen);
7204N/A
7204N/A if (!cogl_framebuffer_allocate (fb, &catch_error))
7204N/A {
7204N/A cogl_error_free (catch_error);
7204N/A+ cogl_object_unref (offscreen);
7204N/A cogl_object_unref (buffer);
7204N/A return NULL;
7204N/A }
7204N/A
7204N/A cogl_color_init_from_4ub (&clear_color, 0, 0, 0, 0);
7204N/A
7204N/A /* XXX: There's no way to render a ClutterActor to an offscreen
7204N/A * as it uses the implicit API. */
7204N/A G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
7204N/A cogl_push_framebuffer (fb);
7204N/A G_GNUC_END_IGNORE_DEPRECATIONS;
7204N/A
7204N/A cogl_framebuffer_clear (fb, COGL_BUFFER_BIT_COLOR, &clear_color);
7204N/A cogl_framebuffer_translate (fb, -box.x1, -box.y1, 0);
7204N/A cogl_framebuffer_orthographic (fb, 0, 0, width, height, 0, 1.0);
7204N/A
7204N/A clutter_actor_set_opacity_override (actor, 255);
7204N/A clutter_actor_paint (actor);
7204N/A clutter_actor_set_opacity_override (actor, -1);
7204N/A
7204N/A--
7204N/A2.7.4
7204N/A