Qt: avoid crash in TQtAbstractSlider.SlotValueChanged() because of update in SetScrollInfo()

git-svn-id: trunk@22063 -
This commit is contained in:
zeljko 2009-10-07 18:47:08 +00:00
parent 04304dd66c
commit 49c3771c08
2 changed files with 15 additions and 10 deletions

View File

@ -5061,8 +5061,8 @@ var
LMScroll: TLMScroll;
begin
{$ifdef VerboseQt}
writeln('TQtAbstractSlider.SlotValueChanged() to value ',p1);
{$endif}
writeln('TQtAbstractSlider.SlotValueChanged() to value ',p1,' inUpdate ',inUpdate);
{$endif}
FillChar(LMScroll, SizeOf(LMScroll), #0);
@ -5076,7 +5076,7 @@ begin
LMScroll.Pos := p1;
LMScroll.ScrollCode := SIF_POS;
if not SliderPressed then
if not SliderPressed and not InUpdate then
DeliverMessage(LMScroll);
end;

View File

@ -4656,14 +4656,19 @@ var
if (ScrollInfo.FMask and SIF_POS) <> 0 then
begin
if (ScrollInfo.nPos < ScrollBar.getMin) then
ScrollInfo.nPos := ScrollBar.getMin
else
if (ScrollInfo.nPos > ScrollBar.getMax) then
ScrollInfo.nPos := ScrollBar.getMax;
ScrollBar.BeginUpdate;
try
if (ScrollInfo.nPos < ScrollBar.getMin) then
ScrollInfo.nPos := ScrollBar.getMin
else
if (ScrollInfo.nPos > ScrollBar.getMax) then
ScrollInfo.nPos := ScrollBar.getMax;
if (ScrollInfo.FMask and SIF_UPDATEPOLICY) = 0 then
ScrollBar.setValue(ScrollInfo.nPos);
if (ScrollInfo.FMask and SIF_UPDATEPOLICY) = 0 then
ScrollBar.setValue(ScrollInfo.nPos);
finally
ScrollBar.EndUpdate;
end;
end;
if (ScrollInfo.FMask and SIF_TRACKPOS) <> 0 then