winmain.c, bug fix, #315 ngspice under windows 10 shows exception on quit
https://sourceforge.net/p/ngspice/bugs/315/ longjmp() creates segfault under Windows 10 (VS and MINGW) somewhere when MainWindowProc() is processing the WM_CLOSE message. Instead of raising SIGINT, directly call cp_doquit(). return 0 if "askquit" is set and the user declines to "quit". This continues the simulation, if still active.
This commit is contained in:
parent
33c7740884
commit
67e06bb4ac
|
|
@ -97,6 +97,8 @@ extern bool ft_ngdebug; /* some additional debug info printed */
|
|||
extern bool ft_batchmode;
|
||||
extern FILE *flogp; /* definition see xmain.c, stdout redirected to file */
|
||||
|
||||
extern void cp_doquit(void);
|
||||
|
||||
#include "winmain.h"
|
||||
|
||||
/* --------------------------<history management>------------------------------ */
|
||||
|
|
@ -506,11 +508,8 @@ MainWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
goto DEFAULT_AFTER;
|
||||
|
||||
case WM_CLOSE:
|
||||
/* Put Spice commmand "Quit" to end the program into the text buffer */
|
||||
PostSpiceCommand("quit");
|
||||
|
||||
/* If simulation is running, set a breakpoint */
|
||||
raise (SIGINT);
|
||||
cp_doquit();
|
||||
/* continue if the user declined the 'quit' command */
|
||||
return 0;
|
||||
|
||||
case WM_SIZE:
|
||||
|
|
|
|||
Loading…
Reference in New Issue