Don't keep running doEvent if MGED_STATE is NULL

Chris ran into a crash in MGED where doEvent was trying to access
something invalid in the course of shutting down.  We tried to
de-register the doEvent callback but that doesn't seem to be effective.
Testing a global flag did work, but Chris spotted that we could just
look for a NULL MGED_STATE instead since we do explicitly NULL that out
in mged_finish.
This commit is contained in:
Clifford Yapp committed 2025-01-06 15:27:33 -05:00
1 parent 650f680e8e
commit 0de845a628
1 file changed
+1 -1
+1 -1
View File
@@ -119,7 +119,7 @@ doEvent(ClientData clientData, XEvent *eventPtr)
struct mged_dm *save_dm_list;
int status;
if (eventPtr->type == DestroyNotify || (unsigned long)eventPtr->xany.window == 0)
if (eventPtr->type == DestroyNotify || (unsigned long)eventPtr->xany.window == 0 || !MGED_STATE)
return TCL_OK;
// The set_curr_dm logic here appears to be important for Multipane mode -