summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-01-05 17:09:56 +0100
committerraveit65 <[email protected]>2021-01-06 13:03:02 +0100
commit06292db3c2b9a4ad81c7063c7bcff7cb6c0f927a (patch)
treeffe349bc46d480da860396bdedf9849030f38c1b
parentb14abf57c20fc848ba1903c40841c3c107ecc7d4 (diff)
downloadmate-panel-06292db3c2b9a4ad81c7063c7bcff7cb6c0f927a.tar.bz2
mate-panel-06292db3c2b9a4ad81c7063c7bcff7cb6c0f927a.tar.xz
wncklet: remove extra ref on gdk_x11_window_foreign_new_for_display
-rw-r--r--applets/wncklet/window-list.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/applets/wncklet/window-list.c b/applets/wncklet/window-list.c
index 8ec3f396..5b0248c7 100644
--- a/applets/wncklet/window-list.c
+++ b/applets/wncklet/window-list.c
@@ -252,6 +252,7 @@ preview_window_thumbnail (WnckWindow *wnck_window,
int *thumbnail_scale)
{
GdkWindow *window;
+ GdkWindow *window_wrapper = NULL;
Window win;
cairo_surface_t *thumbnail;
cairo_t *cr;
@@ -259,10 +260,21 @@ preview_window_thumbnail (WnckWindow *wnck_window,
int width, height, scale;
win = wnck_window_get_xid (wnck_window);
+
if ((window = gdk_x11_window_lookup_for_display (gdk_display_get_default (), win)) == NULL)
{
if ((window = gdk_x11_window_foreign_new_for_display (gdk_display_get_default (), win)) == NULL)
+ {
return NULL;
+ }
+ else
+ {
+ window_wrapper = window;
+ }
+ }
+ else
+ {
+ g_object_ref (window);
}
*thumbnail_scale = scale = gdk_window_get_scale_factor (window);
@@ -294,6 +306,9 @@ preview_window_thumbnail (WnckWindow *wnck_window,
gdk_cairo_set_source_window (cr, window, 0, 0);
cairo_paint (cr);
cairo_destroy (cr);
+
+ if (window_wrapper)
+ g_object_unref (window_wrapper);
g_object_unref (window);
return thumbnail;