From fdb61e9836a604f056e74f47a739ffef3dc062eb Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Fri, 25 Jan 2013 22:17:59 +0100 Subject: [PATCH] Don't allow setting a scrollbar position to nan. Since nan != nan, the scrollbar would otherwise try to move the view to the new position, the view would try to set the scrollbar value again, and so on. --- src/kits/interface/ScrollBar.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/kits/interface/ScrollBar.cpp b/src/kits/interface/ScrollBar.cpp index c12c5ab5b2..9bb0899103 100644 --- a/src/kits/interface/ScrollBar.cpp +++ b/src/kits/interface/ScrollBar.cpp @@ -379,6 +379,8 @@ BScrollBar::SetValue(float value) value = fMax; else if (value < fMin) value = fMin; + else if(isnan(value)) + return; value = roundf(value); @@ -408,7 +410,7 @@ BScrollBar::ValueChanged(float newValue) { TRACE("BScrollBar(%s)::ValueChanged(%.1f)\n", Name(), newValue); - if (fTarget) { + if (fTarget && newValue) { // cache target bounds BRect targetBounds = fTarget->Bounds(); // if vertical, check bounds top and scroll if different from newValue