Commit a68d0d8b authored by Richard Gobeille's avatar Richard Gobeille
Browse files

engine: manually flush console log file ptr in crash handler

parent 29ccc1ec
......@@ -313,7 +313,11 @@ void OSD_DispatchQueued(void);
// executes a string
void OSD_Dispatch(const char *cmd);
void OSD_FlushLog(void);
static FORCE_INLINE void OSD_FlushLog(void)
{
if (osd->log.m_fp)
buildvfs_fflush(osd->log.m_fp);
}
// registers a function
// name = name of the function
......
......@@ -57,7 +57,7 @@ bool m32_osd_tryscript = false; // whether to try executing m32script on unkown
static int osdfunc_printvar(int const cvaridx);
void OSD_UpdateDrawBuffer(void);
void OSD_FlushLog(void);
void OSD_WritePendingLines(void);
void OSD_RegisterCvar(osdcvardata_t * const cvar, int (*func)(osdcmdptr_t))
{
......@@ -1716,7 +1716,7 @@ void OSD_Puts(const char *putstr)
return;
osd->log.m_pending.push(new AtomicLogString(Xstrdup(putstr)));
OSD_FlushLog();
OSD_WritePendingLines();
}
static inline void OSD_LineFeed(void)
......@@ -1755,7 +1755,7 @@ static int OSD_MaybeLogError(char **putstr)
{
auto s = (char *)Xstrdup(*putstr);
buildvfs_fputs(OSD_StripColors(s, *putstr), osd->log.m_fp);
if (isError) buildvfs_fflush(osd->log.m_fp);
if (isError) OSD_FlushLog();
Bprintf("%s", s);
Xfree(s);
}
......@@ -1851,7 +1851,7 @@ void OSD_UpdateDrawBuffer(void)
}
// writes lines from osd->log.m_pending to disk and updates osd->log.m_lines
void OSD_FlushLog(void)
void OSD_WritePendingLines(void)
{
do
{
......
......@@ -332,6 +332,8 @@ static void sighandler(int signum)
// if (signum==SIGSEGV)
{
grabmouse_low(0);
OSD_FlushLog();
#if PRINTSTACKONSEGV
{
void *addr[32];
......
......@@ -219,6 +219,8 @@ static int32_t setgammaramp(LPDDGAMMARAMP gt);
//
static void SignalHandler(int32_t signum)
{
OSD_FlushLog();
switch (signum)
{
case SIGSEGV:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment