Skip to content

Commit

Permalink
Merge pull request #5507 from ericmehl/spreadsheetCrash
Browse files Browse the repository at this point in the history
_LinkedScrollBar : Guard against recursive updates
  • Loading branch information
johnhaddon authored Oct 24, 2023
2 parents 5de3d6e + 80e32aa commit f419cff
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 9 deletions.
4 changes: 3 additions & 1 deletion Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ Improvements
Fixes
-----

- Windows : Fixed a bug preventing anything except strings from being copied and pasted.
- Windows :
- Fixed a bug preventing anything except strings from being copied and pasted.
- Fixed likely cause of crash when resizing Spreadsheet column width (#5296).

1.3.5.0 (relative to 1.3.4.0)
=======
Expand Down
38 changes: 30 additions & 8 deletions python/GafferUI/SpreadsheetUI/_LinkedScrollBar.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,23 +91,45 @@ def __init__( self, orientation, scrolledContainers, **kw ) :
scrollBar.rangeChanged.connect( Gaffer.WeakMethod( self.__rangeChanged ) )
scrollBar.stepsChanged.connect( Gaffer.WeakMethod( self.__stepsChanged ) )

self.__isUpdating = False

def __valueChanged( self, value ) :

for scrollBar in self.__scrollBars :
scrollBar.setValue( value )
if self.__isUpdating :
return

try :
self.__isUpdating = True
for scrollBar in self.__scrollBars :
scrollBar.setValue( value )
finally :
self.__isUpdating = False

def __rangeChanged( self, min, max ) :

for scrollBar in self.__scrollBars :
scrollBar.setRange( min, max )
if self.__isUpdating :
return

self.setVisible( min != max )
try :
self.__isUpdating = True
for scrollBar in self.__scrollBars :
scrollBar.setRange( min, max )
self.setVisible( min != max )
finally :
self.__isUpdating = False

def __stepsChanged( self, page, single ) :

for scrollBar in self.__scrollBars :
scrollBar.setPageStep( page )
scrollBar.setSingleStep( single )
if self.__isUpdating :
return

try :
self.__isUpdating = True
for scrollBar in self.__scrollBars :
scrollBar.setPageStep( page )
scrollBar.setSingleStep( single )
finally :
self.__isUpdating = False

# QScrollBar provides signals for when the value and range are changed,
# but not for when the page step is changed. This subclass adds the missing
Expand Down

0 comments on commit f419cff

Please sign in to comment.