[Lazarus] OI / App crash - components with published interfaces
Andreas Frieß
friess at gmx.at
Sat Feb 17 10:53:48 CET 2018
I have an appcrash when i use components with interfaces in the
published part. See also Bug 32919. I have now simpilied the problem and
isolated from Lazarus itself.
The component is on https://github.com/afriess/LazarusBug0032919 in
OITestBasic, together with the testproject shown here.
Somethigs goes wrong , if call free for the Form ( SIGSEGV ). A sencond
issue is, i did not see the value of the property ObjectHasInterface in
the OI. But i see the value if i click on the Combobox.
My Question:
Did i miss something in the definition of the Components ?
------------ definition components ---------------
type
// define the Interface
ITestInterface = interface
function OnlyDummy: integer;
end;
{ TIntfComp }
TIntfComp = class(TComponent)
private
FObjectHasInterface: ITestInterface;
function GetObjectHasInterface: ITestInterface;
procedure SetObjectHasInterface(AValue: ITestInterface);
published
property ObjectHasInterface: ITestInterface read
GetObjectHasInterface write SetObjectHasInterface;
end;
{ TCompHasIntf }
TCompHasIntf = class(TComponent, ITestInterface)
public
function OnlyDummy: integer;
end;
--------- test programm ------------
DUT := TObjectInspectorDlg.Create(nil);
DUT.Caption:= 'My ObjectInspector';
// create the PropertyEditorHook (the interface to the properties)
ThePropertyEditorHook:=TPropertyEditorHook.Create(DUT);
DUT.PropertyEditorHook:=ThePropertyEditorHook;
// Create components
ATestForm := TForm.Create(nil);
ATestForm.Name:= 'Main';
ATestIntf := TIntfComp.Create(ATestForm); // This componnets
can hold a component with interface
ATestIntf.Name := 'ATestIntf';
ATestHasIntf := TCompHasIntf.Create(ATestForm); // This component
has an Interface
ATestHasIntf.Name:= 'ATestHasIntf';
ATestIntf.ObjectHasInterface := ATestHasIntf;
ATestIntf.GetParentComponent;
ThePropertyEditorHook.LookupRoot:=ATestForm;
PerList:=TPersistentSelectionList.Create;
PerList.Add(ATestForm);
DUT.Selection:=PerList;
PerList.Free;
DUT.Show;
.......
if DUT <> nil then begin
ATestForm.Free; // <----- Appcrash
FreeAndNil(DUT);
end;
----------------------- End ------------------
------------------ Stack ------------------------
#0 fpc_intf_decr_ref at :0
#1 fpc_finalize at :0
#2 ?? at :0
#3 SYSTEM_$$_SETVARIANTMANAGER$TVARIANTMANAGER at :0
#4 ?? at :0
#5 DESTROY(0x3aa8868, 0x0) at include\control.inc:5146
#6 DESTROY(0x3aa8868, 0x0) at include\wincontrol.inc:6626
#7 DESTROY(0x3aa8868, 0x0) at include\customcontrol.inc:40
#8 DESTROY(0x3aa8868, 0x0) at include\scrollingwincontrol.inc:316
#9 DESTROY(0x3aa8868, 0x1) at include\customform.inc:212
#10 SYSTEM$_$TOBJECT_$__$$_FREE at :0
#11 FREEUSEDOBJECTS(0x3ad46f8) at uoitest.pas:161
#12 BUFREECLICK(0x3ad46f8, 0x3ad5878) at uoitest.pas:139
#13 CLICK(0x3ad5878) at include\control.inc:2929
#14 CLICK(0x3ad5878) at include\buttoncontrol.inc:55
#15 CLICK(0x3ad5878) at include\buttons.inc:169
#16 WMDEFAULTCLICKED(0x3ad5878, {MSG = 66567, WPARAM = 0, LPARAM = 0,
RESULT = 0, WPARAMLO = 0, WPARAMHI = 0, WPARAMFILLER = {}, LPARAMLO = 0,
LPARAMHI = 0, LPARAMFILLER = {}, RESULTLO = 0, RESULTHI = 0,
RESULTFILLER = {}}) at include\buttoncontrol.inc:21
#17 SYSTEM$_$TOBJECT_$__$$_DISPATCH$formal at :0
#18 ?? at :0
#19 VMT_$STDCTRLS_$$_TBUTTONCONTROL at :0
#20 VMT_$STDCTRLS_$$_TCUSTOMSTATICTEXT$indirect at :0
#21 STDCTRLS$_$TBUTTONCONTROL_$__$$_ISCHECKEDSTORED$$BOOLEAN at :0
#22 WNDPROC(0x3ad5878, {MSG = 66567, WPARAM = 0, LPARAM = 0, RESULT = 0,
WPARAMLO = 0, WPARAMHI = 0, WPARAMFILLER = {}, LPARAMLO = 0, LPARAMHI =
0, LPARAMFILLER = {}, RESULTLO = 0, RESULTHI = 0, RESULTFILLER = {}}) at
include\wincontrol.inc:5406
#23 DELIVERMESSAGE(0x3ad5878, 0) at lclmessageglue.pas:112
#24 DOWINDOWPROC(0x3b0d780) at win32\win32callback.inc:2534
#25 WINDOWPROC(199064, 273, 22648, 1705918) at win32\win32callback.inc:2696
#26 CUSTOMFORMWNDPROC(199064, 273, 22648, 1705918) at
win32\win32wsforms.pp:386
#27 USER32!AddClipboardFormatListener at :0
#28 USER32!EndTask at :0
#29 DEBUGSTART_$WIN32WSFORMS at :0
#30 USER32!EndTask at :0
#31 ?? at :0
#32 USER32!EndTask at :0
#33 DEBUGSTART_$WIN32WSFORMS at :0
#34 USER32!SendMessageW at :0
#35 CreateMappedBitmap at :0
#36 ImageList_GetIconSize at :0
#37 USER32!AddClipboardFormatListener at :0
#38 USER32!EndTask at :0
#39 ImageList_GetIconSize at :0
#40 USER32!EndTask at :0
#41 ?? at :0
#42 USER32!EndTask at :0
#43 ImageList_GetIconSize at :0
#44 USER32!CallWindowProcW at :0
#45 CALLDEFAULTWINDOWPROC(1705918, 514, 0, 1310774) at
win32\win32callback.inc:97
#46 DOWINDOWPROC(0x3b0d610) at win32\win32callback.inc:2442
#47 WINDOWPROC(1705918, 514, 0, 1310774) at win32\win32callback.inc:2696
#48 BUTTONWNDPROC(1705918, 514, 0, 1310774) at win32\win32wsstdctrls.pp:1791
#49 USER32!AddClipboardFormatListener at :0
#50 USER32!EndTask at :0
#51
WIN32WSSTDCTRLS$_$TWIN32WSBUTTONCONTROL_$__$$_GETPREFERREDSIZE$TWINCONTROL$LONGINT$LONGINT$BOOLEAN
at :0
#52 USER32!EndTask at :0
#53 ?? at :0
#54 USER32!DispatchMessageW at :0
#55 USER32!DispatchMessageW at :0
#56 APPPROCESSMESSAGES(0x3af7fd0) at win32\win32object.inc:407
#57 HANDLEMESSAGE(0x3a98408) at include\application.inc:1276
#58 RUNLOOP(0x3a98408) at include\application.inc:1413
#59 APPRUN(0x3af7fd0, {Proc = {procedure (POINTER)} 0x177ff48, Self =
0x3a98408}) at include\interfacebase.inc:54
#60 RUN(0x3a98408) at include\application.inc:1401
#61 main at GuiOITest.lpr:19
------------------- End Stack ---------------------------
More information about the Lazarus
mailing list