summaryrefslogtreecommitdiff
path: root/src/compositor
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-12-21 17:53:29 +0100
committerraveit65 <[email protected]>2022-01-27 08:29:33 +0100
commit771b7ae6931dffc46288364ad1363a07225862e7 (patch)
tree8d6ff0860a95463616ccbf283843f5c38f9fe7ce /src/compositor
parentcb274b4b3fe7dad642fe27a58a1f4955bcb21e1d (diff)
downloadmarco-771b7ae6931dffc46288364ad1363a07225862e7.tar.bz2
marco-771b7ae6931dffc46288364ad1363a07225862e7.tar.xz
compositor-xrender: fix memory leak
Diffstat (limited to 'src/compositor')
-rw-r--r--src/compositor/compositor-xrender.c52
1 files changed, 33 insertions, 19 deletions
diff --git a/src/compositor/compositor-xrender.c b/src/compositor/compositor-xrender.c
index f70432a7..fff82b21 100644
--- a/src/compositor/compositor-xrender.c
+++ b/src/compositor/compositor-xrender.c
@@ -78,7 +78,7 @@ typedef enum _MetaCompWindowType
typedef enum _MetaShadowType
{
- META_SHADOW_SMALL,
+ META_SHADOW_SMALL = 0,
META_SHADOW_MEDIUM,
META_SHADOW_LARGE,
LAST_SHADOW_TYPE
@@ -450,18 +450,22 @@ presum_gaussian (shadow *shad)
static void
generate_shadows (MetaCompScreen *info)
{
- double radii[LAST_SHADOW_TYPE] = {SHADOW_SMALL_RADIUS,
- SHADOW_MEDIUM_RADIUS,
- SHADOW_LARGE_RADIUS};
- int i;
+ double radii [LAST_SHADOW_TYPE] = {
+ [META_SHADOW_SMALL] = SHADOW_SMALL_RADIUS,
+ [META_SHADOW_MEDIUM] = SHADOW_MEDIUM_RADIUS,
+ [META_SHADOW_LARGE] = SHADOW_LARGE_RADIUS
+ };
- for (i = 0; i < LAST_SHADOW_TYPE; i++) {
- shadow *shad = g_new0 (shadow, 1);
+ MetaShadowType t;
- shad->gaussian_map = make_gaussian_map (radii[i]);
- presum_gaussian (shad);
+ for (t = META_SHADOW_SMALL; t < LAST_SHADOW_TYPE; t++)
+ {
+ shadow *shad;
- info->shadows[i] = shad;
+ shad = g_new0 (shadow, 1);
+ shad->gaussian_map = make_gaussian_map (radii [t]);
+ presum_gaussian (shad);
+ info->shadows [t] = shad;
}
}
@@ -593,12 +597,17 @@ make_shadow (MetaDisplay *display,
return ximage;
}
-double shadow_offsets_x[LAST_SHADOW_TYPE] = {SHADOW_SMALL_OFFSET_X,
- SHADOW_MEDIUM_OFFSET_X,
- SHADOW_LARGE_OFFSET_X};
-double shadow_offsets_y[LAST_SHADOW_TYPE] = {SHADOW_SMALL_OFFSET_Y,
- SHADOW_MEDIUM_OFFSET_Y,
- SHADOW_LARGE_OFFSET_Y};
+double shadow_offsets_x [LAST_SHADOW_TYPE] = {
+ [META_SHADOW_SMALL] = SHADOW_SMALL_OFFSET_X,
+ [META_SHADOW_MEDIUM] = SHADOW_MEDIUM_OFFSET_X,
+ [META_SHADOW_LARGE] = SHADOW_LARGE_OFFSET_X
+};
+
+double shadow_offsets_y[LAST_SHADOW_TYPE] = {
+ [META_SHADOW_SMALL] = SHADOW_SMALL_OFFSET_Y,
+ [META_SHADOW_MEDIUM] = SHADOW_MEDIUM_OFFSET_Y,
+ [META_SHADOW_LARGE] = SHADOW_LARGE_OFFSET_Y
+};
static XserverRegion
cairo_region_to_xserver_region (Display *xdisplay,
@@ -3072,10 +3081,15 @@ xrender_unmanage_screen (MetaCompositor *compositor,
if (info->have_shadows)
{
- int i;
+ MetaShadowType t;
- for (i = 0; i < LAST_SHADOW_TYPE; i++)
- g_free (info->shadows[i]->gaussian_map);
+ for (t = META_SHADOW_SMALL; t < LAST_SHADOW_TYPE; t++)
+ {
+ g_free (info->shadows[t]->gaussian_map);
+ g_free (info->shadows[t]->shadow_corner);
+ g_free (info->shadows[t]->shadow_top);
+ g_free (info->shadows[t]);
+ }
}
XCompositeUnredirectSubwindows (xdisplay, xroot,