summaryrefslogtreecommitdiff
path: root/applets/wncklet/window-list.c
diff options
context:
space:
mode:
authorColomban Wendling <[email protected]>2022-04-26 11:44:47 +0200
committerraveit65 <[email protected]>2022-07-02 17:41:44 +0200
commit7acb97b9b473556dd3199308fd1dcdc31a122d63 (patch)
tree09d5600fb4718e0b0576e6e7175db787cd944ad9 /applets/wncklet/window-list.c
parentfe5d2c10b7942f07efbdca2e48363f3aeb4a9bde (diff)
downloadmate-panel-7acb97b9b473556dd3199308fd1dcdc31a122d63.tar.bz2
mate-panel-7acb97b9b473556dd3199308fd1dcdc31a122d63.tar.xz
wncklet: Fix crash thumbnailing dying or otherwise inaccessible windows
Fixes https://github.com/mate-desktop/mate-desktop/issues/478
Diffstat (limited to 'applets/wncklet/window-list.c')
-rw-r--r--applets/wncklet/window-list.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/applets/wncklet/window-list.c b/applets/wncklet/window-list.c
index 45ed78f4..9c3ca6ff 100644
--- a/applets/wncklet/window-list.c
+++ b/applets/wncklet/window-list.c
@@ -288,6 +288,8 @@ preview_window_thumbnail (WnckWindow *wnck_window,
*thumbnail_width = (int) ((double) width * ratio);
}
+ gdk_x11_display_error_trap_push (gdk_window_get_display (window));
+
thumbnail = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
*thumbnail_width,
*thumbnail_height);
@@ -298,6 +300,12 @@ preview_window_thumbnail (WnckWindow *wnck_window,
cairo_paint (cr);
cairo_destroy (cr);
+ if (gdk_x11_display_error_trap_pop (gdk_window_get_display (window)))
+ {
+ cairo_surface_destroy (thumbnail);
+ thumbnail = NULL;
+ }
+
g_object_unref (window);
return thumbnail;