From 86c188e74ee23bd03aee8bfa91807efcc2f163c1 Mon Sep 17 00:00:00 2001 From: Francesco Montorsi Date: Sat, 25 Apr 2009 13:10:07 +0000 Subject: [PATCH] fix wxASSERT_MSG in PopStatusText: we always need to have at least one string in the stack; explicitely refresh the affected status bar pane in Push/PopStatusText as SetStatusText() optimization to avoid flickering cannot detect the stack manipulation which happened (closes #10733) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60341 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/statbar.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/common/statbar.cpp b/src/common/statbar.cpp index 0dee67251b..d27ddb0a4c 100644 --- a/src/common/statbar.cpp +++ b/src/common/statbar.cpp @@ -197,11 +197,21 @@ void wxStatusBarBase::PushStatusText(const wxString& text, int number) SetStatusText(text, number); // update current status text (which will possibly be ellipsized) // also in the native control + + // SetStatusText() typically has an optimization built-in to avoid flickering + // which won't refresh the status bar pane if the current top of the stack + // is identic to the text passed to that function. + // Since this optimization however cannot detect push/pop operations on the stack + // we need to explicitely refresh the status bar pane ourselves: + wxRect rect; + GetFieldRect(number, rect); + Refresh(true, &rect); + Update(); } void wxStatusBarBase::PopStatusText(int number) { - wxASSERT_MSG(m_panes[number].m_arrStack.GetCount() >= 1, + wxASSERT_MSG(m_panes[number].m_arrStack.GetCount() > 1, "can't pop any further string"); // the top of the stack is the status text currently shown in the native control; @@ -211,6 +221,13 @@ void wxStatusBarBase::PopStatusText(int number) // restore the previous status text in the native control const wxString& text = m_panes[number].m_arrStack.back(); SetStatusText(text, number); + + // see comment in wxStatusBarBase::PushStatusText about why we need to explicitely + // refresh the status bar pane + wxRect rect; + GetFieldRect(number, rect); + Refresh(true, &rect); + Update(); } #endif // wxUSE_STATUSBAR -- 2.45.2