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