1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-31 03:00:05 +00:00
JUCE/modules/juce_gui_basics/layout
reuk ad5a755b10
Viewport: Avoid stack overflows when displaying transformed content components
For some transforms, the program could get stuck in the following loop:
- The content component emits a resized/moved notification, leading to
  the initial call to Viewport::updateVisibleArea.
- New positions are computed for the viewport scrollbars, and scrollbar
  listeners are notified synchronously that the scrollbars have been
  updated.
- The viewport itself listens to the scrollbars, so it receives a
  notification and updates the position of the content component.
- The scrollbar position (quantised to an integer) resolves to a
  component position (also quantised to an integer) that differs from
  the existing position, so the new position is applied.
- The viewport now attempts to set the scrollbars to the correct
  position in response, and notifies listeners that the scrollbars
  have moved...

Normally, the recursion would exit at the point where the component position
is set to its current position. If we're unlucky, though, converting
from view pos to scrollbar pos, then scrollbar pos back to view pos may
result in a view pos that differs from the original value.

This fix adds a new exit condition from the recursion. On receiving a
scrollbar move notification, we check whether the scrollbar position
computed from the current view position matches the incoming scrollbar
position. If it does, there's no need to compute and apply a new view
position from the incoming scrollbar position.
2024-10-02 11:35:38 +01:00
..
juce_AnimatedPosition.h
juce_AnimatedPositionBehaviours.h
juce_BorderedComponentBoundsConstrainer.cpp
juce_BorderedComponentBoundsConstrainer.h
juce_ComponentAnimator.cpp
juce_ComponentAnimator.h
juce_ComponentBoundsConstrainer.cpp
juce_ComponentBoundsConstrainer.h
juce_ComponentBuilder.cpp
juce_ComponentBuilder.h
juce_ComponentMovementWatcher.cpp
juce_ComponentMovementWatcher.h
juce_ConcertinaPanel.cpp
juce_ConcertinaPanel.h
juce_FlexBox.cpp
juce_FlexBox.h
juce_FlexItem.h
juce_Grid.cpp
juce_Grid.h
juce_GridItem.cpp
juce_GridItem.h
juce_GroupComponent.cpp
juce_GroupComponent.h
juce_MultiDocumentPanel.cpp
juce_MultiDocumentPanel.h
juce_ResizableBorderComponent.cpp
juce_ResizableBorderComponent.h
juce_ResizableCornerComponent.cpp
juce_ResizableCornerComponent.h
juce_ResizableEdgeComponent.cpp
juce_ResizableEdgeComponent.h
juce_ScrollBar.cpp
juce_ScrollBar.h
juce_SidePanel.cpp
juce_SidePanel.h
juce_StretchableLayoutManager.cpp
juce_StretchableLayoutManager.h
juce_StretchableLayoutResizerBar.cpp
juce_StretchableLayoutResizerBar.h
juce_StretchableObjectResizer.cpp
juce_StretchableObjectResizer.h
juce_TabbedButtonBar.cpp
juce_TabbedButtonBar.h
juce_TabbedComponent.cpp
juce_TabbedComponent.h
juce_Viewport.cpp Viewport: Avoid stack overflows when displaying transformed content components 2024-10-02 11:35:38 +01:00
juce_Viewport.h Viewport: Avoid stack overflows when displaying transformed content components 2024-10-02 11:35:38 +01:00