View Issue Details

IDProjectCategoryView StatusLast Update
0035583LazarusLCLpublic2020-06-12 11:30
Reporterhdrz Assigned ToJuha Manninen  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platformx64OSwin10 home 
Product Version2.0 
Summary0035583: TTIGRID crashes on boolean properties
DescriptionUsing the TTIGrid example provided by lazarus, and adding a boolean property to the object, the grid crashes with SIGSEGV.
It should render a checkbox if I'm not mistaken.
Steps To ReproduceOpen RTTI example project 'exampleprojectgrid1', Add a boolean property to the object and run.

--- removed the copy/pasted code by Juha. ---
Additional InformationThe SIGSEGV is raised by the function 'TPropertyEditorHook.GetHandlerCount' in the file 'propedits.pp', specifically on line 7291 which reads: 'if FHandlers[HookType]<>nil then'. The array 'FHandlers' seems not to be in context for some reason...
TagsNo tags attached.
Fixed in Revisionr63345
LazTarget-
WidgetsetWin32/Win64
Attached Files

Relationships

related to 0032545 new Lazarus TTIEdit doesnot support UnicodeString properties 
related to 0037202 resolvedJuha Manninen Packages TTidGrid crached on destroy 

Activities

Juha Manninen

2019-05-14 19:46

developer   ~0116197

Could you please upload a compressed demo app instead of copying code to "Steps To Reproduce" field.

hdrz

2019-05-15 06:51

reporter   ~0116201

The sample project is attached here

Juha Manninen

2019-05-17 10:22

developer   ~0116232

Yes I can reproduce.
The crash happens when changing LookupRoot for the properties. It is called before TForm1.Form1Create of the app.
Somehow the Boolean prop still messes it up. Interesting ...
You can also try to debug what is going on.

greenfil

2020-06-11 08:48

reporter   ~0123390

problem - rttigrid.propertyeditor.propertyhook=nil
possible fix^
FPC fix
1)
          NewEditor:=EditorClass.Create(nil,1);
change
          NewEditor:=EditorClass.Create(FHeaderPropHook,1);

2) or user fix
  { TMyBoolProperty }

  TMyBoolProperty=class(TBoolProperty)
  public
    constructor Create(Hook: TPropertyEditorHook; APropCount: Integer); override;
  end;
---
constructor TMyBoolProperty.Create(Hook: TPropertyEditorHook;
  APropCount: Integer);
begin
  if not Assigned(Hook) then
    Hook:=TPropertyEditorHook.Create;
  inherited Create(Hook, APropCount);
end;
---
RegisterPropertyEditor(TypeInfo(Boolean), nil, '', TMyBoolProperty);

Juha Manninen

2020-06-11 10:16

developer   ~0123391

The line :
  NewEditor:=EditorClass.Create(nil,1);
is also in Lazarus sources, more precisely in procedure TTICustomGrid.GetCellEditor().
So the fix is not for FPC sources.
I will look at it later today ...

Juha Manninen

2020-06-11 23:13

developer   ~0123404

Yes, your proposed change fixed it. Applied, thanks!

Issue History

Date Modified Username Field Change
2019-05-14 14:26 hdrz New Issue
2019-05-14 19:46 Juha Manninen Note Added: 0116197
2019-05-15 06:51 hdrz File Added: examplesprojectgrid1.zip
2019-05-15 06:51 hdrz Note Added: 0116201
2019-05-17 10:09 Juha Manninen Steps to Reproduce Updated View Revisions
2019-05-17 10:09 Juha Manninen LazTarget => -
2019-05-17 10:09 Juha Manninen Widgetset Win32/Win64 => Win32/Win64
2019-05-17 10:22 Juha Manninen Note Added: 0116232
2019-10-19 12:58 Juha Manninen Relationship added related to 0032545
2020-06-11 08:48 greenfil Note Added: 0123390
2020-06-11 10:16 Juha Manninen Note Added: 0123391
2020-06-11 23:13 Juha Manninen Assigned To => Juha Manninen
2020-06-11 23:13 Juha Manninen Status new => resolved
2020-06-11 23:13 Juha Manninen Resolution open => fixed
2020-06-11 23:13 Juha Manninen Fixed in Revision => r63345
2020-06-11 23:13 Juha Manninen Widgetset Win32/Win64 => Win32/Win64
2020-06-11 23:13 Juha Manninen Note Added: 0123404
2020-06-12 11:30 Juha Manninen Relationship added related to 0037202