One correction to the previous commit to avoid running

Tk_RestrictEvents() when in batch mode (no graphics, therefore no
Tk);  otherwise, this causes magic to segfault.
This commit is contained in:
R. Timothy Edwards 2026-06-23 10:53:47 -04:00
parent d8046fba2d
commit 06f0ce4259
3 changed files with 13 additions and 6 deletions

View File

@ -731,7 +731,8 @@ CIFGenSubcells(
Tk_RestrictProc *oldProc;
ClientData oldArg;
oldProc = Tk_RestrictEvents(RestrictInputProc, (ClientData)NULL, &oldArg);
if (SigInterruptOnSigIO != -1) /* Check for batch mode */
oldProc = Tk_RestrictEvents(RestrictInputProc, (ClientData)NULL, &oldArg);
#endif /* MAGIC_WRAPPER */
UndoDisable();
@ -884,7 +885,8 @@ CIFGenSubcells(
#ifdef MAGIC_WRAPPER
/* Restore full event access */
Tk_RestrictEvents(oldProc, oldArg, &oldArg);
if (SigInterruptOnSigIO != -1) /* Check for batch mode */
Tk_RestrictEvents(oldProc, oldArg, &oldArg);
#endif /* MAGIC_WRAPPER */
UndoEnable();

View File

@ -189,7 +189,8 @@ extSubtree(parentUse, reg, f)
Tk_RestrictProc *oldProc;
ClientData oldArg;
oldProc = Tk_RestrictEvents(RestrictInputProc, (ClientData)NULL, &oldArg);
if (SigInterruptOnSigIO != -1) /* Check for batch mode */
oldProc = Tk_RestrictEvents(RestrictInputProc, (ClientData)NULL, &oldArg);
#endif /* MAGIC_WRAPPER */
/* Use the display timer to force a 5-second progress check */
@ -385,7 +386,8 @@ done:
#ifdef MAGIC_WRAPPER
/* Restore full event access */
Tk_RestrictEvents(oldProc, oldArg, &oldArg);
if (SigInterruptOnSigIO != -1) /* Check for batch mode */
Tk_RestrictEvents(oldProc, oldArg, &oldArg);
#endif /* MAGIC_WRAPPER */
}

View File

@ -27,6 +27,7 @@ static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magi
#include "utils/hash.h"
#include "utils/undo.h"
#include "utils/utils.h"
#include "utils/signals.h"
#include "database/database.h"
#include "windows/windows.h"
#include "dbwind/dbwind.h"
@ -2532,7 +2533,8 @@ DefRead(
* corrupt the database during DEF reads.
*/
oldProc = Tk_RestrictEvents(RestrictInputProc, (ClientData)NULL, &oldArg);
if (SigInterruptOnSigIO != -1) /* Check for batch mode */
oldProc = Tk_RestrictEvents(RestrictInputProc, (ClientData)NULL, &oldArg);
#endif /* MAGIC_WRAPPER */
/* Initialize */
@ -2758,7 +2760,8 @@ DefRead(
#ifdef MAGIC_WRAPPER
/* Restore full event access */
Tk_RestrictEvents(oldProc, oldArg, &oldArg);
if (SigInterruptOnSigIO != -1) /* Check for batch mode */
Tk_RestrictEvents(oldProc, oldArg, &oldArg);
#endif /* MAGIC_WRAPPER */
return rootDef;