|
1
|
+From 8f204678be6d888ad1d2904e28af1aa9f2ad8e11 Mon Sep 17 00:00:00 2001
|
|
2
|
+From: Faidon Liambotis <paravoid@debian.org>
|
|
3
|
+Date: Sat, 3 Jul 2021 01:10:22 +0300
|
|
4
|
+Subject: [PATCH] tabpopup: fix cairo surface leak
|
|
5
|
+
|
|
6
|
+Commit 6b05da5e49996a2101edfd703dd3f5d91011d726 introduced a Cairo
|
|
7
|
+surface leak, by calling gdk_cairo_surface_create_from_pixbuf() but then
|
|
8
|
+never freeing those surfaces with cairo_surface_destroy().
|
|
9
|
+
|
|
10
|
+This manifested in leaking resources when switching between virtual
|
|
11
|
+desktops, as observed using xrestop ("Pxms" column), which made the
|
|
12
|
+desktop slow and ultimately unusable after a few weeks of uptime.
|
|
13
|
+
|
|
14
|
+Fixes #685
|
|
15
|
+---
|
|
16
|
+ src/ui/draw-workspace.c | 8 +++++++-
|
|
17
|
+ 1 file changed, 7 insertions(+), 1 deletion(-)
|
|
18
|
+
|
|
19
|
+diff --git a/src/ui/draw-workspace.c b/src/ui/draw-workspace.c
|
|
20
|
+index 8229abd00..fc8f82e55 100644
|
|
21
|
+--- a/src/ui/draw-workspace.c
|
|
22
|
++++ b/src/ui/draw-workspace.c
|
|
23
|
+@@ -131,6 +131,7 @@ draw_window (GtkWidget *widget,
|
|
24
|
+ /* If the icon is too big, fall back to mini icon. */
|
|
25
|
+ if (icon_w > (winrect->width - 2) || icon_h > (winrect->height - 2))
|
|
26
|
+ {
|
|
27
|
++ cairo_surface_destroy (icon);
|
|
28
|
+ icon = gdk_cairo_surface_create_from_pixbuf (win->mini_icon, scale, NULL);
|
|
29
|
+ if (icon)
|
|
30
|
+ {
|
|
31
|
+@@ -139,7 +140,10 @@ draw_window (GtkWidget *widget,
|
|
32
|
+
|
|
33
|
+ /* Give up. */
|
|
34
|
+ if (icon_w > (winrect->width - 2) || icon_h > (winrect->height - 2))
|
|
35
|
+- icon = NULL;
|
|
36
|
++ {
|
|
37
|
++ cairo_surface_destroy (icon);
|
|
38
|
++ icon = NULL;
|
|
39
|
++ }
|
|
40
|
+ }
|
|
41
|
+ }
|
|
42
|
+ }
|
|
43
|
+@@ -155,6 +159,8 @@ draw_window (GtkWidget *widget,
|
|
44
|
+ cairo_clip (cr);
|
|
45
|
+ cairo_paint (cr);
|
|
46
|
+ cairo_restore (cr);
|
|
47
|
++
|
|
48
|
++ cairo_surface_destroy (icon);
|
|
49
|
+ }
|
|
50
|
+
|
|
51
|
+ gtk_style_context_get_color (style, state, &color);
|