From: Vadim Zeitlin Date: Sun, 27 Feb 2011 12:47:43 +0000 (+0000) Subject: Initialize wxButton::m_authNeeded in ctor and not Create() in wxMSW. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/98977bf454c66de733241ba22248ca9e9e185759 Initialize wxButton::m_authNeeded in ctor and not Create() in wxMSW. Ensure that the member is always initialized as calling GetAuthNeeded() for a default-constructed button would access a non-initialized variable before. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67058 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/msw/button.h b/include/wx/msw/button.h index 14e1e708cd..5d78464ef4 100644 --- a/include/wx/msw/button.h +++ b/include/wx/msw/button.h @@ -100,6 +100,7 @@ private: void Init() { m_imageData = NULL; + m_authNeeded = false; } // Switches button into owner-drawn mode: this is used if we need to draw diff --git a/src/msw/button.cpp b/src/msw/button.cpp index e08d58e3be..4eea5a4c5a 100644 --- a/src/msw/button.cpp +++ b/src/msw/button.cpp @@ -450,8 +450,6 @@ bool wxButton::Create(wxWindow *parent, const wxValidator& validator, const wxString& name) { - m_authNeeded = false; - wxString label(lbl); if (label.empty() && wxIsStockID(id)) {