From 9dfcf62c3c43edf07e10a6ced7d814d857941144 Mon Sep 17 00:00:00 2001 From: Zedhugh Chen Date: Wed, 3 Sep 2025 00:22:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20get=5Fwindow=5Fclass=5Fins?= =?UTF-8?q?tance=20=E5=87=BD=E6=95=B0=E4=B8=AD=E7=9A=84=E5=86=85=E5=AD=98?= =?UTF-8?q?=E9=87=8A=E6=94=BE=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/xcb/window.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/xcb/window.c b/src/xcb/window.c index 60845fe..8900c3c 100644 --- a/src/xcb/window.c +++ b/src/xcb/window.c @@ -43,7 +43,8 @@ void get_window_class_instance(xcb_window_t window, xcb_icccm_get_wm_class_reply_t prop; const char *class = NULL; const char *instance = NULL; - if (xcb_icccm_get_wm_class_reply(conn, cookie, &prop, NULL)) { + bool has_reply = xcb_icccm_get_wm_class_reply(conn, cookie, &prop, NULL); + if (has_reply) { class = prop.class_name; instance = prop.instance_name; } else { @@ -54,7 +55,7 @@ void get_window_class_instance(xcb_window_t window, strncpy(class_instance->class, class, LENGTH(class_instance->class)); strncpy(class_instance->instance, instance, LENGTH(class_instance->instance)); - xcb_icccm_get_wm_class_reply_wipe(&prop); + if (has_reply) xcb_icccm_get_wm_class_reply_wipe(&prop); } static visual_t *find_alpha_visual() {