summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFaidon Liambotis <[email protected]>2021-07-03 01:10:22 +0300
committerVictor Kareh <[email protected]>2021-07-09 09:53:23 -0400
commit8f204678be6d888ad1d2904e28af1aa9f2ad8e11 (patch)
treea9c4a39bea5eaaa2a73bb167d8b11f7e426e01e1
parent3ed0ddb242a4804cd7fcfcfcf39a47766eaa816d (diff)
downloadmarco-8f204678be6d888ad1d2904e28af1aa9f2ad8e11.tar.bz2
marco-8f204678be6d888ad1d2904e28af1aa9f2ad8e11.tar.xz
tabpopup: fix cairo surface leak
Commit 6b05da5e49996a2101edfd703dd3f5d91011d726 introduced a Cairo surface leak, by calling gdk_cairo_surface_create_from_pixbuf() but then never freeing those surfaces with cairo_surface_destroy(). This manifested in leaking resources when switching between virtual desktops, as observed using xrestop ("Pxms" column), which made the desktop slow and ultimately unusable after a few weeks of uptime. Fixes #685
-rw-r--r--src/ui/draw-workspace.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ui/draw-workspace.c b/src/ui/draw-workspace.c
index 8229abd0..fc8f82e5 100644
--- a/src/ui/draw-workspace.c
+++ b/src/ui/draw-workspace.c
@@ -131,6 +131,7 @@ draw_window (GtkWidget *widget,
/* If the icon is too big, fall back to mini icon. */
if (icon_w > (winrect->width - 2) || icon_h > (winrect->height - 2))
{
+ cairo_surface_destroy (icon);
icon = gdk_cairo_surface_create_from_pixbuf (win->mini_icon, scale, NULL);
if (icon)
{
@@ -139,7 +140,10 @@ draw_window (GtkWidget *widget,
/* Give up. */
if (icon_w > (winrect->width - 2) || icon_h > (winrect->height - 2))
- icon = NULL;
+ {
+ cairo_surface_destroy (icon);
+ icon = NULL;
+ }
}
}
}
@@ -155,6 +159,8 @@ draw_window (GtkWidget *widget,
cairo_clip (cr);
cairo_paint (cr);
cairo_restore (cr);
+
+ cairo_surface_destroy (icon);
}
gtk_style_context_get_color (style, state, &color);