Improve x_free_gc checking when debugging

* src/xfaces.c (x_free_gc): When debugging,
also diagnose unlikely case when ngcs == INT_MIN.
This commit is contained in:
Paul Eggert 2026-06-01 09:55:18 -07:00
parent 7502836378
commit 43f1630346

View file

@ -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);
}