From 12f6eb2c4e865198947457977d742785e36bea5d Mon Sep 17 00:00:00 2001 From: sergei Date: Thu, 28 Oct 2010 04:18:53 +0000 Subject: [PATCH] * types.pp, applied a fix similar to r16224,16226 also to UnionRect function. It is very similar to IntersectRect and parameter aliasing issue applies to it as well (see Mantis #17722). git-svn-id: trunk@16235 - --- rtl/objpas/types.pp | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/rtl/objpas/types.pp b/rtl/objpas/types.pp index 806e7d6a92..698469126b 100644 --- a/rtl/objpas/types.pp +++ b/rtl/objpas/types.pp @@ -373,26 +373,29 @@ begin end; function UnionRect(var Rect : TRect;const R1,R2 : TRect) : Boolean; +var + lRect: TRect; begin - Rect:=R1; - with R2 do - begin - if LeftR1.Right then - Rect.Right:=Right; - if Bottom>R1.Bottom then - Rect.Bottom:=Bottom; - end; + lRect:=R1; + if R2.LeftR1.Right then + lRect.Right:=R2.Right; + if R2.Bottom>R1.Bottom then + lRect.Bottom:=R2.Bottom; + if IsRectEmpty(Rect) then - begin + begin FillChar(Rect,SizeOf(Rect),0); UnionRect:=false; - end + end else + begin + Rect:=lRect; UnionRect:=true; + end; end; function IsRectEmpty(const Rect : TRect) : Boolean;