tvplanit: No more IDE crash (was caused by over-range error in dvLineMatrix of TDayView, procedures SetTimeIntervals, DrawCells)

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4801 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-06-22 12:16:45 +00:00
parent 264448b7e4
commit 78e60575cc
2 changed files with 16 additions and 14 deletions

View File

@ -33,24 +33,26 @@ unit VpAbout;
interface
uses
{$IFDEF LCL}
LMessages, LCLProc, LCLType, LCLIntf,
Forms, Graphics, Controls, Dialogs, StdCtrls, ExtCtrls,
{$IFDEF VERSION6}
{$IFDEF DELPHI}
DesignIntf, DesignEditors,
{$ELSE}
PropEdits, LazarusPackageIntf,
{$ENDIF}
{$IFDEF LCL}
LMessages, LCLProc, LCLType, LCLIntf,
{$ELSE}
Windows, Messages,
{$ENDIF}
Forms, Graphics, Controls, Dialogs, StdCtrls, ExtCtrls,
{$IFDEF VERSION6}
{$IFDEF DELPHI}
DesignIntf, DesignEditors,
{$ELSE}
DsgnIntf,
PropEdits, LazarusPackageIntf,
{$ENDIF}
Classes, SysUtils;
{$ELSE}
DsgnIntf,
{$ENDIF}
Classes, SysUtils;
type
{ TfrmAbout }
TfrmAbout = class(TForm)
Bevel2: TBevel;
Panel1: TPanel;

View File

@ -1483,7 +1483,7 @@ begin
SetLength(dvLineMatrix, NumDays);
for I := 0 to pred(NumDays) do begin
SetLength(dvLineMatrix[I], LineCount);
SetLength(dvLineMatrix[I], LineCount); // was +1. Why? Without it, the IDE crashes! - there is an upper loop index of LineCount in DrawCells. After correcting that, the crash is gone.
for J := 0 to pred(LineCount) do begin
dvLineMatrix[I,J].Hour := TVpHours(J div grPerHour);
dvLineMatrix[I,J].Minute := (J mod grPerHour) * GranularityMinutes[UseGran];
@ -3585,7 +3585,7 @@ var
TPSMoveTo(RenderCanvas, Angle, RenderIn, GutterRect.Right, GutterRect.Top);
TPSLineTo(RenderCanvas, Angle, RenderIn, GutterRect.Right, GutterRect.Bottom);
for I := 0 to LineCount do begin
for I := 0 to LineCount-1 do begin // this was "LineCount", without -1 --> IDE crash
dvLineMatrix[Col, I].Rec.Left := -1;
dvLineMatrix[Col, I].Rec.Top := -1;
dvLineMatrix[Col, I].Rec.Right := -1;