From 7f52d9fff197a0ce0a0e0709ac4d93a546d87ef9 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sat, 29 Jun 2024 20:02:45 +0800 Subject: [PATCH] Fix typo incurring leaks of face structures * src/xfaces.c (free_realized_face): Always free realized face structures, and avoid sending X requests when the display is not available, not when it is. (cherry picked from commit 2d8881d5267febd0bc4117c2b7e5ee6c33ef436e) --- src/xfaces.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/xfaces.c b/src/xfaces.c index 1e0196a1171..188dd4778bc 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -4599,8 +4599,8 @@ free_realized_face (struct frame *f, struct face *face) /* This function might be called with the frame's display connection deleted, in which event the callbacks below should not be executed, as they generate X requests. */ - if (FRAME_X_DISPLAY (f)) - return; + if (!FRAME_X_DISPLAY (f)) + goto free_face; #endif /* HAVE_X_WINDOWS */ if (face->gc) @@ -4619,6 +4619,9 @@ free_realized_face (struct frame *f, struct face *face) } #endif /* HAVE_WINDOW_SYSTEM */ +#ifdef HAVE_X_WINDOWS + free_face: +#endif /* HAVE_X_WINDOWS */ xfree (face); } } -- 2.39.2