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.
This commit is contained in:
Vadim Zeitlin
2021-01-16 13:50:32 +01:00
parent 508a4f6ca8
commit 5babe577ce

View File

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