Save and restore GrDisplayStatus across long operations

CIFGenSubcells() and extSubtree() set GrDisplayStatus =
DISPLAY_IN_PROGRESS while they run a 5-second progress timer, then
unconditionally restore DISPLAY_IDLE on exit. In native builds the
initial state is always IDLE, so this is harmless. In WASM/headless
builds the null display driver sets DISPLAY_SUSPEND at startup, and
forcing IDLE at the end of these long operations destroys the
SUSPEND guard that protects WindUpdate() from running display
callbacks against a non-existent screen.

Save the previous status before overwriting and restore it on exit.
This is also reentrant-safe: nested DISPLAY_IN_PROGRESS scopes (e.g.
extract followed by gds write) now keep the outer state intact.

* cif/CIFhier.c — CIFGenSubcells
* extract/ExtSubtree.c — extSubtree
This commit is contained in:
Intubun
2026-05-11 14:20:47 -04:00
committed by R. Timothy Edwards
parent 476bb5474c
commit 6fc7b30386
2 changed files with 7 additions and 3 deletions
+3 -1
View File
@@ -174,8 +174,10 @@ extSubtree(parentUse, reg, f)
int cuts, totcuts;
float pdone, plast;
SearchContext scx;
int savedDisplayStatus;
/* Use the display timer to force a 5-second progress check */
savedDisplayStatus = GrDisplayStatus;
GrDisplayStatus = DISPLAY_IN_PROGRESS;
SigSetTimer(5); /* Print at 5-second intervals */
@@ -348,7 +350,7 @@ done:
/* Output connections and node adjustments */
extOutputConns(&ha.ha_connHash, f);
HashKill(&ha.ha_connHash);
GrDisplayStatus = DISPLAY_IDLE;
GrDisplayStatus = savedDisplayStatus;
SigRemoveTimer();
/* Clear the CU_SUB_EXTRACTED flag from all children instances */