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
This commit is contained in:
Vadim Zeitlin 2010-12-15 13:36:44 +00:00
parent 66f7556189
commit 0538419f9e

View File

@ -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);