tvplanit: Fix crash of VpDayViewPainter caused by deleting uncreated regions (issue #33763, idea by linux-man)

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6439 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-05-19 22:05:59 +00:00
parent 6629fa2cc6
commit 54a4101f8a

View File

@ -1070,9 +1070,9 @@ end;
procedure TVpDayViewPainter.DrawEventText(const AText: String;
const AEventRect, AIconRect: TRect; ALevel: Integer);
var
WorkRegion1: HRGN;
WorkRegion2: HRGN;
TextRegion: HRGN;
WorkRegion1: HRGN = 0;
WorkRegion2: HRGN = 0;
TextRegion: HRGN = 0;
CW: Integer;
begin
if (FDayView.WrapStyle <> wsNone) then begin
@ -1104,15 +1104,9 @@ begin
Rect(AEventRect.Right - 6, AEventRect.Bottom - 7, AEventRect.Right - 3, AEventRect.Bottom - 4));
end;
finally
if ((AEventRect.Bottom > AIconRect.Bottom) and (AEventRect.Left > AIconRect.Right)) or
(FDayView.WrapStyle = wsIconFlow)
then begin
DeleteObject(WorkRegion1);
DeleteObject(WorkRegion2);
DeleteObject(TextRegion);
end else begin
DeleteObject(TextRegion);
end;
if WorkRegion1 <> 0 then DeleteObject(WorkRegion1);
if WorkRegion2 <> 0 then DeleteObject(WorkRegion2);
if TextRegion <> 0 then DeleteObject(TextRegion);
end;
end
else begin