View Issue Details

IDProjectCategoryView StatusLast Update
0031923LazarusTAChartpublic2017-06-09 23:08
ReporterPaweł Dmitruk Assigned ToOndrej Pokorny  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.9 (SVN) 
Summary0031923: TChart - Range check error
Descriptiondrag a TChart contol to a form -> show message "Range chek error" -> the Lazarus IDE crashes

Lazarus trunk (55083)/fpc 3.0.2 (win32), Windows 7

------
in lazarus 1.8rc1 it's all ok
TagsNo tags attached.
Fixed in Revision55098
LazTarget-
WidgetsetWin32/Win64
Attached Files

Relationships

related to 0031995 closedwp Dropping TAChart component from palette to a form creates a range error 

Activities

wp

2017-05-26 00:37

developer   ~0100690

Happens after r54955 (by Ondrej), r54954 is still ok.

wp

2017-05-26 09:31

developer   ~0100702

Ondrej, I am assigning this report to you because you did r54955.

This is the IDE's stack trace of the crash:

Hint: (lazarus) [TPkgManager.AddUnitDependenciesForComponentClasses] Adding Project Dependency project1 -> TAChartLazarusPkg
Hint: (lazarus) [TPkgManager.AddUnitDependenciesForComponentClasses] Extending Uses unit1.pas TAGraph
TApplication.HandleException Access violation
  Stack trace:
  $01209D75
  $0078A380 line 2576 of propedits.pp
  $0078C1B4 line 3411 of propedits.pp
  $0078F3EC line 4537 of propedits.pp
  $0078C20C line 3418 of propedits.pp
  $0077CFC7 line 2988 of objectinspector.pp
  $0077C8C0 line 3068 of objectinspector.pp
  $0077D987 line 3145 of objectinspector.pp
  $0077DCB9 line 3189 of objectinspector.pp
  $005A37E1 line 132 of include/customcontrol.inc
  $0058C92D line 4819 of include/wincontrol.inc
  $00590B45 line 6772 of include/wincontrol.inc
  $005A36ED line 112 of include/customcontrol.inc
  $0040FD28
  $0058DDE3 line 5396 of include/wincontrol.inc
  $006625D6 line 112 of lclmessageglue.pas
  $0056BF3C line 702 of win32/win32callback.inc

wp

2017-05-26 10:00

developer   ~0100703

Last edited: 2017-05-26 10:06

View 2 revisions

The crash happens when accessing XMax, the first float property of TChartExtent (declared in unit TATypes). The line within TPropertyEditor.IsDefaultValue executed to crash is the one with CallStoredFunction

  function TPropertyEditor.IsDefaultValue: boolean;
  begin
    ...
    if HasStoredFunction then begin
      Result := not CallStoredFunction; // <-- crashing here
    end else


After removing the "stored IsBoundsStored" in the property declaration of TChartExtent the crash is gone:

  TChartExtent = class(TChartElement)
  ...
  published
    property UseXMax: Boolean index 3 read GetUseBounds write SetUseBounds default false;
    property UseXMin: Boolean index 1 read GetUseBounds write SetUseBounds default false;
    property UseYMax: Boolean index 4 read GetUseBounds write SetUseBounds default false;
    property UseYMin: Boolean index 2 read GetUseBounds write SetUseBounds default false;
    property XMax: Double index 3 read GetBounds write SetBounds; // stored IsBoundsStored;
    property XMin: Double index 1 read GetBounds write SetBounds; // stored IsBoundsStored;
    property YMax: Double index 4 read GetBounds write SetBounds; // stored IsBoundsStored;
    property YMin: Double index 2 read GetBounds write SetBounds; // stored IsBoundsStored;
  end;

So, the problem is: What's wrong with IsBoundStored?

  function TChartExtent.IsBoundsStored(AIndex: Integer): Boolean;
  begin
    Result := FExtent.coords[AIndex] <> 0;
  end;

Ondrej Pokorny

2017-05-26 13:11

developer   ~0100709

> So, the problem is: What's wrong with IsBoundStored?

TPropertyEditor cannot handle the AIndex parameter yet. (I forgot about it completely.) It should be possible to add. I'll check ASAP.

Ondrej Pokorny

2017-05-26 13:54

developer   ~0100710

Should be fixed.

Btw. You should use the SameValue function in "TChartExtent.IsBoundsStored" -
 you compare double values there.

wp

2017-05-26 14:27

developer   ~0100711

@Ondrej: Just had the idea with the different signature of the IsBoundsStored function - and you already have the solution! Thank you.

Thanks also for the hint to using "SameValue". Although I believe that only exact zeros will make it to this code position I'll apply this change.


@Paweł Dmitruk: Please test and close if ok.

Paweł Dmitruk

2017-05-26 16:35

reporter   ~0100712

Thanks

Issue History

Date Modified Username Field Change
2017-05-26 00:10 Paweł Dmitruk New Issue
2017-05-26 00:37 wp Note Added: 0100690
2017-05-26 09:31 wp Assigned To => Ondrej Pokorny
2017-05-26 09:31 wp Status new => assigned
2017-05-26 09:31 wp Note Added: 0100702
2017-05-26 10:00 wp Note Added: 0100703
2017-05-26 10:06 wp Note Edited: 0100703 View Revisions
2017-05-26 13:11 Ondrej Pokorny Note Added: 0100709
2017-05-26 13:54 Ondrej Pokorny Fixed in Revision => 55098
2017-05-26 13:54 Ondrej Pokorny LazTarget => -
2017-05-26 13:54 Ondrej Pokorny Note Added: 0100710
2017-05-26 13:54 Ondrej Pokorny Status assigned => resolved
2017-05-26 13:54 Ondrej Pokorny Resolution open => fixed
2017-05-26 14:27 wp Note Added: 0100711
2017-05-26 16:35 Paweł Dmitruk Note Added: 0100712
2017-05-26 16:35 Paweł Dmitruk Status resolved => closed
2017-06-09 23:08 wp Relationship added related to 0031995