Add a wxLog::DoCreateOnDemand and call it from DoCommonPreInit so that

logging will work even if wxWidgets is reentered after being cleaned up.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46117 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Elliott 2007-05-18 21:17:06 +00:00
parent 879180b655
commit e94cd97dd7
3 changed files with 11 additions and 0 deletions

View File

@ -181,6 +181,9 @@ public:
// current is NULL? // current is NULL?
static void DontCreateOnDemand(); static void DontCreateOnDemand();
// Make GetActiveTarget() create a new log object again.
static void DoCreateOnDemand();
// log the count of repeating messages instead of logging the messages // log the count of repeating messages instead of logging the messages
// multiple times // multiple times
static void SetRepetitionCounting(bool bRepetCounting = true) static void SetRepetitionCounting(bool bRepetCounting = true)

View File

@ -220,6 +220,9 @@ static void FreeConvertedArgs()
static bool DoCommonPreInit() static bool DoCommonPreInit()
{ {
#if wxUSE_LOG #if wxUSE_LOG
// Reset logging in case we were cleaned up and are being reinitialized.
wxLog::DoCreateOnDemand();
// install temporary log sink: we can't use wxLogGui before wxApp is // install temporary log sink: we can't use wxLogGui before wxApp is
// constructed and if we use wxLogStderr, all messages during // constructed and if we use wxLogStderr, all messages during
// initialization simply disappear under Windows // initialization simply disappear under Windows

View File

@ -575,6 +575,11 @@ void wxLog::DontCreateOnDemand()
ClearTraceMasks(); ClearTraceMasks();
} }
void wxLog::DoCreateOnDemand()
{
ms_bAutoCreate = true;
}
void wxLog::RemoveTraceMask(const wxString& str) void wxLog::RemoveTraceMask(const wxString& str)
{ {
int index = ms_aTraceMasks.Index(str); int index = ms_aTraceMasks.Index(str);