From 2a201ef80240946d33cfca4d7622698a7cb09692 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 14 Aug 2003 00:10:20 +0000 Subject: [PATCH] fixed extraneous scrolling when scrollbars are added/removed (patch 788026; bug 746618) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22836 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/scrlwing.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 -- 2.45.2