From 97a4909b73e75328433d9f66becb69449c49b1f8 Mon Sep 17 00:00:00 2001 From: Volker Ruppert Date: Mon, 26 Dec 2016 16:12:54 +0000 Subject: [PATCH] When reading configuration from the wx gui, an error no longer closes the whole app. Now only the bochsrc parsing terminates with an error. Improved message box shown at this point. --- bochs/gui/wxmain.cc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/bochs/gui/wxmain.cc b/bochs/gui/wxmain.cc index 957f67757..24a126e91 100644 --- a/bochs/gui/wxmain.cc +++ b/bochs/gui/wxmain.cc @@ -281,19 +281,17 @@ BxEvent *MyApp::DefaultCallback(void *thisptr, BxEvent *event) case BX_ASYNC_EVT_LOG_MSG: case BX_SYNC_EVT_LOG_ASK: { wxLogDebug(wxT("DefaultCallback: log ask event")); - wxString text; - text.Printf(wxT("Error: %s"), event->u.logmsg.msg); if (wxBochsClosing) { // gui closing down, do something simple and nongraphical. + wxString text; + text.Printf(wxT("Error: %s"), event->u.logmsg.msg); fprintf(stderr, "%s\n", (const char *)text.mb_str(wxConvUTF8)); + event->retcode = BX_LOG_ASK_CHOICE_DIE; } else { - wxMessageBox(text, wxT("Error"), wxOK | wxICON_ERROR); - // maybe I can make OnLogAsk display something that looks appropriate. - // theFrame->OnLogAsk(event); + wxString levelName(SIM->get_log_level_name(event->u.logmsg.level), wxConvUTF8); + wxMessageBox(wxString(event->u.logmsg.msg, wxConvUTF8), levelName, wxOK | wxICON_ERROR); + event->retcode = BX_LOG_ASK_CHOICE_CONTINUE; } - event->retcode = BX_LOG_ASK_CHOICE_DIE; - // There is only one thread at this point. if I choose DIE here, it will - // call fatal() and kill the whole app. break; } case BX_SYNC_EVT_TICK: