From 204645a47cb6d9d39d0324a2d4c1c2cbb18881d2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 13 Dec 2020 00:48:23 +0100 Subject: [PATCH] Initialize all fields in wxWebRequestEvent default ctor Default ctor was leaving pointers uninitialized which was dangerous, so merge it with the other ctor to ensure that we always set them to NULL. Also make m_response const as it can't be changed after creating the event. --- include/wx/webrequest.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/wx/webrequest.h b/include/wx/webrequest.h index b1223d7ce4..65d371975c 100644 --- a/include/wx/webrequest.h +++ b/include/wx/webrequest.h @@ -262,9 +262,11 @@ private: class WXDLLIMPEXP_NET wxWebRequestEvent : public wxEvent { public: - wxWebRequestEvent() {} - wxWebRequestEvent(wxEventType type, int id, wxWebRequest::State state, - wxWebResponse* response = NULL, const wxString& errorDesc = "") + wxWebRequestEvent(wxEventType type = wxEVT_NULL, + int id = wxID_ANY, + wxWebRequest::State state = wxWebRequest::State_Idle, + wxWebResponse* response = NULL, + const wxString& errorDesc = wxString()) : wxEvent(id, type), m_state(state), m_response(response), m_data(NULL), m_dataSize(0), m_errorDescription(errorDesc) @@ -291,7 +293,7 @@ public: private: wxWebRequest::State m_state; - wxWebResponse* m_response; // non-owning, may be NULL + wxWebResponse* const m_response; // non-owning, may be NULL wxString m_responseFileName; const void* m_data; size_t m_dataSize;