From: Vadim Zeitlin Date: Wed, 15 Dec 2010 13:36:44 +0000 (+0000) Subject: Initialize wxLogWindow::m_pLogFrame in ctor to avoid (rare) crash. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/0538419f9e7d1fd4af57f2f4e38c339cd091b0c5?ds=sidebyside Initialize wxLogWindow::m_pLogFrame in ctor to avoid (rare) crash. If the log frame creation itself generates log messages, the code using wxLogWindow could crash because its m_pLogFrame member variable wasn't initialized yet at this moment. Do set it to NULL initially now to avoid this. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66383 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/logg.cpp b/src/generic/logg.cpp index e769bfb2bd..67fee0d39c 100644 --- a/src/generic/logg.cpp +++ b/src/generic/logg.cpp @@ -610,6 +610,11 @@ wxLogWindow::wxLogWindow(wxWindow *pParent, bool bShow, bool bDoPass) { + // Initialize it to NULL to ensure that we don't crash if any log messages + // are generated before the frame is fully created (while this doesn't + // happen normally, it might, in principle). + m_pLogFrame = NULL; + PassMessages(bDoPass); m_pLogFrame = new wxLogFrame(pParent, this, szTitle);