Skip to content

Commit

Permalink
Try to deinit GUI during a panic().
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed May 19, 2007
1 parent 053eafb commit 7deec5f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
21 changes: 21 additions & 0 deletions CMakeLists.txt
Expand Up @@ -271,6 +271,27 @@ IF(MOJOSETUP_GUI_STDIO)
ENDIF(MOJOSETUP_GUI_STDIO_STATIC)
ENDIF(MOJOSETUP_GUI_STDIO)

# BINARY SIZE += !!! FIXME: check this.
IF(UNIX) # !!! FIXME: use FindCurses instead...
IF(NOT BEOS)
IF(NOT MACOSX)
OPTION(MOJOSETUP_GUI_NCURSES "Enable ncurses GUI" TRUE)
IF(MOJOSETUP_GUI_NCURSES)
ADD_DEFINITIONS(-DSUPPORT_GUI_NCURSES=1)
OPTION(MOJOSETUP_GUI_NCURSES_STATIC "Statically link ncurses GUI" TRUE)
IF(MOJOSETUP_GUI_NCURSES_STATIC)
ADD_DEFINITIONS(-DGUI_STATIC_LINK_NCURSES=1)
SET(OPTIONAL_SRCS ${OPTIONAL_SRCS} gui_ncurses.c)
SET(OPTIONAL_LIBS ${OPTIONAL_LIBS} -lncurses) # !!! FIXME
ELSE(MOJOSETUP_GUI_NCURSES_STATIC)
ADD_LIBRARY(mojosetupgui_ncurses SHARED gui_ncurses.c)
TARGET_LINK_LIBRARIES(mojosetupgui_ncurses "-lncurses") # !!! FIXME
ENDIF(MOJOSETUP_GUI_NCURSES_STATIC)
ENDIF(MOJOSETUP_GUI_NCURSES)
ENDIF(NOT MACOSX)
ENDIF(NOT BEOS)
ENDIF(UNIX)

IF(MACOSX)
OPTION(MOJOSETUP_GUI_MACOSX "Enable Mac OS X GUI" TRUE)
IF(MOJOSETUP_GUI_MACOSX)
Expand Down
3 changes: 3 additions & 0 deletions gui.c
Expand Up @@ -31,6 +31,9 @@ static const MojoGuiEntryPoint staticGui[] =
#endif
#if GUI_STATIC_LINK_GTKPLUS2
MojoGuiPlugin_gtkplus2,
#endif
#if GUI_STATIC_LINK_NCURSES
MojoGuiPlugin_ncurses,
#endif
NULL
};
Expand Down
2 changes: 1 addition & 1 deletion gui.h
Expand Up @@ -166,8 +166,8 @@ const MojoGui *MOJOGUI_ENTRY_POINT(int rev, const MojoSetupEntryPoints *e) \
* some aren't...
*/

// Probably want to support this always, unless explicitly overridden.
const MojoGui *MojoGuiPlugin_stdio(int rev, const MojoSetupEntryPoints *e);
const MojoGui *MojoGuiPlugin_ncurses(int rev, const MojoSetupEntryPoints *e);
const MojoGui *MojoGuiPlugin_gtkplus2(int rev, const MojoSetupEntryPoints *e);
const MojoGui *MojoGuiPlugin_macosx(int rev, const MojoSetupEntryPoints *e);

Expand Down
9 changes: 7 additions & 2 deletions mojosetup.c
Expand Up @@ -380,9 +380,14 @@ int panic(const char *err)

else if (panic_runs == 2)
{
if ((GGui != NULL) && (GGui->msgbox != NULL))
boolean domsgbox = ((GGui != NULL) && (GGui->msgbox != NULL));
if (domsgbox)
GGui->msgbox(_("PANIC"), err);
else

if (GGui->deinit != NULL)
GGui->deinit();

if (!domsgbox)
panic(err); /* no GUI plugin...double-panic. */
} // if

Expand Down

0 comments on commit 7deec5f

Please sign in to comment.