Recent

Author Topic: TAChart crashing in Lazarus 1.8RC2  (Read 3640 times)

wp

  • Hero Member
  • *****
  • Posts: 11855
TAChart crashing in Lazarus 1.8RC2
« on: June 09, 2017, 11:43:47 pm »
In Laz1.8RC2, TAChart will crash with a range-check error when a chart is clicked onto the form. Unfortunately a patch had not been backported from trunk to RC2.

Here are instructions how to fix this severe issue in your RC2 manually:
  • Open file propedits.pp. It is in folder components/ideintf of your Lazarus installation
  • Seek the implementation of the method TPropertyEditor.CallStoredFunction, it should begin near line 2560.
  • Replace this function, along with the preceding declaration of TBoolFunc, with the following code. Then rebuild the IDE (Menu "Tools" > "Build Lazarus with profile..."
Code: Pascal  [Select][+][-]
  1. type
  2.   TBoolFunc = function: Boolean of object;
  3.   TBoolIndexFunc = function(const Index: Integer): Boolean of object;
  4. function TPropertyEditor.CallStoredFunction: Boolean;
  5. var
  6.   Met: TMethod;
  7.   Func: TBoolFunc;
  8.   IndexFunc: TBoolIndexFunc;
  9.   APropInfo: PPropInfo;
  10.   StoredProcType: Byte;
  11. begin
  12.   APropInfo:=FPropList^[0].PropInfo;
  13.   StoredProcType := ((APropInfo^.PropProcs shr 4) and 3);
  14.   if StoredProcType in [ptStatic, ptVirtual] then
  15.   begin
  16.     case StoredProcType of
  17.       ptStatic: Met.Code := APropInfo^.StoredProc;
  18.       ptVirtual: Met.Code := PPointer(Pointer(FPropList^[0].Instance.ClassType))[{%H-}PtrInt(APropInfo^.StoredProc) div SizeOf(Pointer)];
  19.     end;
  20.     if Met.Code = nil then
  21.       raise EPropertyError.Create('No property stored method available');
  22.     Met.Data := FPropList^[0].Instance;
  23.     if ((APropInfo^.PropProcs shr 6) and 1) <> 0 then // has index property
  24.     begin
  25.       IndexFunc := TBoolIndexFunc(Met);
  26.       Result := IndexFunc(APropInfo^.Index);
  27.     end else
  28.     begin
  29.       Func := TBoolFunc(Met);
  30.       Result := Func();
  31.     end;
  32.   end else
  33.   if StoredProcType = ptConst then
  34.     Result := APropInfo^.StoredProc<>nil
  35.   else
  36.     raise EPropertyError.Create('No property stored method/const available');
  37. end;

Wonderer

  • Newbie
  • Posts: 1
Re: TAChart crashing in Lazarus 1.8RC2
« Reply #1 on: July 29, 2017, 05:43:00 pm »
 Thank you very much, fixed the range check error perfectly.

 

TinyPortal © 2005-2018