]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed extraneous scrolling when scrollbars are added/removed (patch 788026; bug 746618)
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 14 Aug 2003 00:10:20 +0000 (00:10 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 14 Aug 2003 00:10:20 +0000 (00:10 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22836 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/scrlwing.cpp

index bf9a58d3fab62c1df8acde8d1f9c66a7568d9171..bce06f0b5eb58a5961db55f66d3173117c14172a 100644 (file)
@@ -44,6 +44,7 @@
 #include "wx/timer.h"
 #endif
 #include "wx/sizer.h"
+#include "wx/recguard.h"
 
 #ifdef __WXMSW__
     #include <windows.h> // 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