From 5babe577ce2dcdbc25751f7c2a9e9caf8cf32dc4 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 16 Jan 2021 13:50:32 +0100 Subject: [PATCH] Check that SetState() always actually switches states We shouldn't call SetState() to switch to the state that we're currently already in, normally. Add an assert to verify that this indeed doesn't happen. Also improve the logging statement to show both the old and the new states. --- src/common/webrequest.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/common/webrequest.cpp b/src/common/webrequest.cpp index 1c46b0012e..117f9c51be 100644 --- a/src/common/webrequest.cpp +++ b/src/common/webrequest.cpp @@ -207,7 +207,9 @@ struct StateEventProcessor void wxWebRequestImpl::SetState(wxWebRequest::State state, const wxString & failMsg) { - wxLogTrace(wxTRACE_WEBREQUEST, "Request %p: state => %d", this, state); + wxASSERT_MSG( state != m_state, "shouldn't switch to the same state" ); + + wxLogTrace(wxTRACE_WEBREQUEST, "Request %p: state %d => %d", this, m_state, state); m_state = state;