]> git.saurik.com Git - wxWidgets.git/commitdiff
Add a wxLog::DoCreateOnDemand and call it from DoCommonPreInit so that
authorDavid Elliott <dfe@tgwbd.org>
Fri, 18 May 2007 21:17:06 +0000 (21:17 +0000)
committerDavid Elliott <dfe@tgwbd.org>
Fri, 18 May 2007 21:17:06 +0000 (21:17 +0000)
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

include/wx/log.h
src/common/init.cpp
src/common/log.cpp

index 089e21f8ea6fbee64e0e73142128e792c28cf148..c547984bb925f8046eecdec9b106bad19d97f773 100644 (file)
@@ -181,6 +181,9 @@ public:
     // current is NULL?
     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
     // multiple times
     static void SetRepetitionCounting(bool bRepetCounting = true)
index bb5693e4a99e9f650fdc725a78c8d5c8ff1713ab..639a614addebac7e86e3ae3416dab64cc9ede133 100644 (file)
@@ -220,6 +220,9 @@ static void FreeConvertedArgs()
 static bool DoCommonPreInit()
 {
 #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
     // constructed and if we use wxLogStderr, all messages during
     // initialization simply disappear under Windows
index 8c477ef29c0b4d69da199cb6c99d9758e6ed7b10..1604899a5897fd96471c3c8ad42c3afc26a324c0 100644 (file)
@@ -575,6 +575,11 @@ void wxLog::DontCreateOnDemand()
     ClearTraceMasks();
 }
 
+void wxLog::DoCreateOnDemand()
+{
+    ms_bAutoCreate = true;
+}
+
 void wxLog::RemoveTraceMask(const wxString& str)
 {
     int index = ms_aTraceMasks.Index(str);