Skip to content
Snippets Groups Projects
Commit 347c87ea authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

use abort() instead of exit() when we really want to exit *now*
parent 7b5cbc1a
No related branches found
No related tags found
No related merge requests found
// $Id: Message.cpp,v 1.46 2004-02-07 01:28:51 geuzaine Exp $ // $Id: Message.cpp,v 1.47 2004-05-09 18:59:37 geuzaine Exp $
// //
// Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
// //
...@@ -203,6 +203,19 @@ void Msg(int level, char *fmt, ...) ...@@ -203,6 +203,19 @@ void Msg(int level, char *fmt, ...)
void Exit(int level) void Exit(int level)
{ {
// delete the temp file
unlink(CTX.tmprc_filename);
if(level){
// in case of an abnormal exit, force the abort directly
// (bypassing any post main stuff, e.g. destructors for static
// variables). This still guarantees that any open streams are
// flushed and closed, but can prevent nasty infinite loops.
abort();
}
// if we exit cleanly (level==0) and we are in full GUI mode, save
// the persistent info to disk
if(WID && !CTX.batch) { if(WID && !CTX.batch) {
if(CTX.session_save) { if(CTX.session_save) {
CTX.position[0] = WID->m_window->x(); CTX.position[0] = WID->m_window->x();
...@@ -219,19 +232,17 @@ void Exit(int level) ...@@ -219,19 +232,17 @@ void Exit(int level)
CTX.stat_position[1] = WID->stat_window->y(); CTX.stat_position[1] = WID->stat_window->y();
CTX.vis_position[0] = WID->vis_window->x(); CTX.vis_position[0] = WID->vis_window->x();
CTX.vis_position[1] = WID->vis_window->y(); CTX.vis_position[1] = WID->vis_window->y();
// bof
CTX.ctx_position[0] = WID->context_geometry_window->x(); CTX.ctx_position[0] = WID->context_geometry_window->x();
CTX.ctx_position[1] = WID->context_geometry_window->y(); CTX.ctx_position[1] = WID->context_geometry_window->y();
CTX.solver_position[0] = WID->solver[0].window->x(); CTX.solver_position[0] = WID->solver[0].window->x();
CTX.solver_position[1] = WID->solver[0].window->y(); CTX.solver_position[1] = WID->solver[0].window->y();
Print_Options(0, GMSH_SESSIONRC, CTX.sessionrc_filename); Print_Options(0, GMSH_SESSIONRC, CTX.sessionrc_filename);
} }
if(CTX.options_save) if(CTX.options_save)
Print_Options(0, GMSH_OPTIONSRC, CTX.optionsrc_filename); Print_Options(0, GMSH_OPTIONSRC, CTX.optionsrc_filename);
} }
unlink(CTX.tmprc_filename); //delete temp file
exit(level); exit(0);
} }
// CPU time computation, etc. // CPU time computation, etc.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment