Prevent crash when ControlledExit* is not initialized

in ngspice shared library.
This commit is contained in:
Holger Vogt 2023-06-18 10:32:01 +02:00
parent b0f2ab8764
commit 87f0db6f50
1 changed files with 4 additions and 2 deletions

View File

@ -2033,6 +2033,7 @@ ATTRIBUTE_NORETURN void shared_exit(int status)
fl_exited = TRUE; fl_exited = TRUE;
bgtr(fl_exited, ng_ident, userptr); bgtr(fl_exited, ng_ident, userptr);
// set a flag that ngspice wants to be detached // set a flag that ngspice wants to be detached
if(ngexit)
ngexit(status, FALSE, coquit, ng_ident, userptr); ngexit(status, FALSE, coquit, ng_ident, userptr);
// finish and exit the worker thread // finish and exit the worker thread
#ifdef HAVE_LIBPTHREAD #ifdef HAVE_LIBPTHREAD
@ -2042,6 +2043,7 @@ ATTRIBUTE_NORETURN void shared_exit(int status)
#endif #endif
} }
// set a flag in caller to detach ngspice.dll // set a flag in caller to detach ngspice.dll
if(ngexit)
ngexit(status, immediate, coquit, ng_ident, userptr); ngexit(status, immediate, coquit, ng_ident, userptr);
// jump back to finish the calling function // jump back to finish the calling function