Commit b62ac135 authored by ondrej's avatar ondrej
Browse files

LCL: fixed r50991 #b61461e7: infinite loop and crash with TScrollingWinControl. issue #29194.

Tested and works with Win32 and Gtk2.
Qt has a related (different) bug when detecting the scroll area for invisible window - it has to be fixed separately.

git-svn-id: trunk@50994 -
parent 4fbab4bd
......@@ -74,11 +74,6 @@ begin
// position has to be set before FControl.ScrollBy !!!
FPosition := Value;
{calling scrollby when handle is invisible produces infinite loop with win32 and qt widgetsets.
see issue #29194}
if HandleAllocated and not IsWindowVisible(ControlHandle) then
exit;
// scroll logical client area of FControl
if Kind = sbVertical then
FControl.ScrollBy(0, PrevPosition - FPosition)
......
......@@ -6136,10 +6136,10 @@ end;
procedure TWinControl.ScrollBy_WS(DeltaX, DeltaY: Integer);
begin
if HandleAllocated and IsWindowVisible(Handle) then
if HandleAllocated then
TWSWinControlClass(WidgetSetClass).ScrollBy(Self, DeltaX, DeltaY)
else
ScrollBy(DeltaX, DeltaY);
raise Exception.Create('TWinControl.ScrollBy_WS: Handle not allocated');
end;
procedure TWinControl.ScrollBy(DeltaX, DeltaY: Integer);
......
......@@ -560,7 +560,7 @@ end;
class procedure TWin32WSWinControl.ScrollBy(const AWinControl: TWinControl;
DeltaX, DeltaY: integer);
begin
if Windows.IsWindowVisible(AWinControl.Handle) then
if AWinControl.HandleAllocated then
ScrollWindowEx(AWinControl.Handle, DeltaX, DeltaY, nil, nil, 0, nil,
SW_INVALIDATE or SW_ERASE or SW_SCROLLCHILDREN);
end;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment