X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c4513b23896c274eb859e0856d7e391b04f77819..a430d03e5f1b1fbd6c11a090a9aaaad84fb2a5d9:/src/generic/scrlwing.cpp diff --git a/src/generic/scrlwing.cpp b/src/generic/scrlwing.cpp index bf9a58d3fa..bce06f0b5e 100644 --- a/src/generic/scrlwing.cpp +++ b/src/generic/scrlwing.cpp @@ -44,6 +44,7 @@ #include "wx/timer.h" #endif #include "wx/sizer.h" +#include "wx/recguard.h" #ifdef __WXMSW__ #include // for DLGC_WANTARROWS @@ -621,6 +622,19 @@ int wxScrollHelper::CalcScrollInc(wxScrollWinEvent& event) // Adjust the scrollbars - new version. void wxScrollHelper::AdjustScrollbars() { + static wxRecursionGuardFlag s_flagReentrancy; + wxRecursionGuard guard(s_flagReentrancy); + if ( guard.IsInside() ) + { + // don't reenter AdjustScrollbars() while another call to + // AdjustScrollbars() is in progress because this may lead to calling + // ScrollWindow() twice and this can really happen under MSW if + // SetScrollbar() call below adds or removes the scrollbar which + // changes the window size and hence results in another + // AdjustScrollbars() call + return; + } + #ifdef __WXMAC__ m_targetWindow->Update(); #endif