From 43f163034682d0139a9986117bce7945ed60c1e9 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 1 Jun 2026 09:55:18 -0700 Subject: [PATCH] Improve x_free_gc checking when debugging * src/xfaces.c (x_free_gc): When debugging, also diagnose unlikely case when ngcs == INT_MIN. --- src/xfaces.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/xfaces.c b/src/xfaces.c index fcec00fbc1f..dafc50f559f 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -539,7 +539,7 @@ static void x_free_gc (struct frame *f, GC gc) { eassert (input_blocked_p ()); - IF_DEBUG ((--ngcs, eassert (ngcs >= 0))); + IF_DEBUG ((eassert (ngcs > 0), ngcs--)); XFreeGC (FRAME_X_DISPLAY (f), gc); } @@ -565,7 +565,7 @@ x_create_gc (struct frame *f, unsigned long mask, Emacs_GC *egc) static void x_free_gc (struct frame *f, Emacs_GC *gc) { - IF_DEBUG ((--ngcs, eassert (ngcs >= 0))); + IF_DEBUG ((eassert (ngcs > 0), ngcs--)); xfree (gc); }