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.
This commit is contained in:
Vadim Zeitlin
2020-12-13 00:48:23 +01:00
parent 0c9f4ababa
commit 204645a47c

View File

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