components/gnome/gnome-shell/patches/03-offscreen-leak.patch
author Niveditha Rau <Niveditha.Rau@Oracle.COM>
Fri, 28 Oct 2016 17:56:16 -0700
changeset 7206 23066e5fef27
permissions -rw-r--r--
23245637 Deliver gnome-shell 3.18.3 in Solaris PSARC/2016/396 GNOME 3 Window Manager Bundle
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7206
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
     1
Upstream patch for gnome-shell memory leak recommended by gnome distros list
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
     2
https://mail.gnome.org/archives/distributor-list/2016-March/msg00006.html
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
     3
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
     4
From 4a8b9d62c98539972cf553fa8101567ce37d73c4 Mon Sep 17 00:00:00 2001
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
     5
From: Aaron Plattner <[email protected]>
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
     6
Date: Fri, 18 Mar 2016 16:00:05 -0700
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
     7
Subject: [PATCH] st: Fix offscreen leak if cogl_framebuffer_allocate fails
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
     8
X-NVConfidentiality: public
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
     9
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    10
If cogl_framebuffer_allocate fails in _st_create_shadow_pipeline_from_actor, the
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    11
CoglOffscreen* that was allocated earlier in the function is leaked.
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    12
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    13
https://bugzilla.gnome.org/show_bug.cgi?id=735705
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    14
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    15
Signed-off-by: Aaron Plattner <[email protected]>
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    16
---
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    17
 src/st/st-private.c | 1 +
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    18
 1 file changed, 1 insertion(+)
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    19
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    20
diff --git a/src/st/st-private.c b/src/st/st-private.c
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    21
index 559336c42d15..d40eceb86c78 100644
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    22
--- a/src/st/st-private.c
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    23
+++ b/src/st/st-private.c
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    24
@@ -425,40 +425,41 @@ _st_create_shadow_pipeline_from_actor (StShadow     *shadow_spec,
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    25
       clutter_actor_get_allocation_box (actor, &box);
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    26
       clutter_actor_box_get_size (&box, &width, &height);
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    27
 
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    28
       if (width == 0 || height == 0)
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    29
         return NULL;
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    30
 
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    31
       buffer = cogl_texture_new_with_size (width,
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    32
                                            height,
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    33
                                            COGL_TEXTURE_NO_SLICING,
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    34
                                            COGL_PIXEL_FORMAT_ANY);
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    35
 
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    36
       if (buffer == NULL)
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    37
         return NULL;
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    38
 
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    39
       offscreen = cogl_offscreen_new_with_texture (buffer);
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    40
       fb = COGL_FRAMEBUFFER (offscreen);
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    41
 
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    42
       if (!cogl_framebuffer_allocate (fb, &catch_error))
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    43
         {
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    44
           cogl_error_free (catch_error);
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    45
+          cogl_object_unref (offscreen);
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    46
           cogl_object_unref (buffer);
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    47
           return NULL;
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    48
         }
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    49
 
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    50
       cogl_color_init_from_4ub (&clear_color, 0, 0, 0, 0);
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    51
 
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    52
       /* XXX: There's no way to render a ClutterActor to an offscreen
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    53
        * as it uses the implicit API. */
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    54
       G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    55
       cogl_push_framebuffer (fb);
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    56
       G_GNUC_END_IGNORE_DEPRECATIONS;
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    57
 
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    58
       cogl_framebuffer_clear (fb, COGL_BUFFER_BIT_COLOR, &clear_color);
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    59
       cogl_framebuffer_translate (fb, -box.x1, -box.y1, 0);
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    60
       cogl_framebuffer_orthographic (fb, 0, 0, width, height, 0, 1.0);
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    61
 
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    62
       clutter_actor_set_opacity_override (actor, 255);
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    63
       clutter_actor_paint (actor);
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    64
       clutter_actor_set_opacity_override (actor, -1);
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    65
 
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    66
-- 
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    67
2.7.4
23066e5fef27 23245637 Deliver gnome-shell 3.18.3 in Solaris
Niveditha Rau <Niveditha.Rau@Oracle.COM>
parents:
diff changeset
    68