To Juha Manninen
As per our discussion here is my status about the -CR flag.
- I have added in WSLCLClasses a list ordered by the synthetic class
- Implemented a pendant to laz_check_object_ext that handles specifically the registered WSLCLComponent's descendants
This requires modification to FPC where I added a callback holder and modified
laz_check_object_ext so in case of inheritance error it executes the laz_check_object_ext.
- Added at the end of systemh.inc
{*****************************************************************************
Lazarus callback for Verify Method Call (switch -CR)
*****************************************************************************}
type
TLazarusCRCallback = function(vmt, expvmt : pointer): Boolean;
const
LazarusCRCallback : TLazarusCRCallback = nil;
Patched fpc_check_object_ext in generic.inc with
procedure fpc_check_object_ext(vmt, expvmt : pointer); [public,alias:'FPC_CHECK_OBJECT_EXT']; compilerproc;
var
lvmt : pointer;
begin
if (vmt=nil) or
(pobjectvmt(vmt)^.size=0) or
(pobjectvmt(vmt)^.size+pobjectvmt(vmt)^.msize<>0) then
RunError(210);
lvmt := vmt;
while assigned(vmt) do
if vmt=expvmt then
exit
else
vmt:=pobjectvmt(vmt)^.parent;
if Assigned(LazarusCRCallback) and LazarusCRCallback(lvmt, expvmt) then
Exit;
RunError(219);
end;
- Implemented a callback function in laz_check_object_ext
{ Extend class type verification to handle the double inheritance of the
TWSLCLComponents. If the component TWS<Widget><WSLCLClass> is found,
check that its 'lateral' component in the TWS<Class> tree matches
inheritence constraints. }
function laz_check_object_ext(vmt, expvmt: pointer) : Boolean;
var
idx : integer;
lComponentClass : TComponentClass;
begin
Result := WSLCLClassesList.Search(TComponentClass(vmt), idx);
if Result then begin
lComponentClass := TComponentClass(PClassNode(WSLCLClassesList[idx])^.LCLParentClass);
Result := lComponentClass.InheritsFrom(TClass(expvmt));
end;
end;
All that stuff goes quite well. One wrong transtype occurs quickly in TWinControl.DoAllAutoSize function CheckHandleAllocated , very easy to fix. See wincontrol.inc.patch.
The next one is in the designer TSetDesigningComponent.SetDesigningOfComponent class procedure.
Do you want to proceed further. If yes indicate in what form you want me to return my current code.
I attach a LCLComponent_VCR.patch for LCLClasses and WSLCLClasses so you can have a look.