summaryrefslogtreecommitdiff
path: root/applets
diff options
context:
space:
mode:
authorColomban Wendling <[email protected]>2022-04-26 11:44:47 +0200
committerVictor Kareh <[email protected]>2022-04-26 08:33:38 -0400
commit02618b724a15443f6e5b4ce05612204d41269fa4 (patch)
tree0f3de7645c88a71a297ccdb389362f2965141620 /applets
parentf25d859347d32c363fb1e0a15266d66b06022b6c (diff)
downloadmate-panel-02618b724a15443f6e5b4ce05612204d41269fa4.tar.bz2
mate-panel-02618b724a15443f6e5b4ce05612204d41269fa4.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')
-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 32e6a602..f9e14f2b 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;