[fpc-devel] 0010465: CsSubComponent component properties not streamed

Martin Schreiber fpmse at bluewin.ch
Mon Dec 24 18:47:15 CET 2007


On Monday 24 December 2007 12.17:38 Bee wrote:
> > I have Delphi code that shows the bug, if you want, so maybe Martin can
> > submit a bugreport at Codegear for a change :-)
>
> It's a dilemma. Though scientifically Delphi's mechanism is wrong but we
> can't just 'fix' it, especially if there are lot of codes that depend on
> it, or if Borland/CodeGear let the bug exists on purpose (backward
> compatibility?). The fix will break the Delphi 'compatibility'.
>
> I suggest FPC to keep the Delphi compatibility to be as much as
> possible, or even 100% if possible. BUT, keep those compatibilities on
> Delphi mode only. That's what Delphi mode is all about, right? FPC could
> use the better/correct mechanism on and only on FPC mode.
>
Or add a check for NIL owner. So if the owner of the component property is the 
streamed component or NIL, the component properties are streamed, otherwise 
the reference is streamed.

"
procedure TWriter.WriteProperty(Instance: TPersistent; PropInfo: Pointer);
[...]
          { Subcomponents are streamed the same way as persistents }
          if ObjValue.InheritsFrom(TComponent)
            and ((not (csSubComponent in TComponent(ObjValue).ComponentStyle)) 
or
                 (TComponent(ObjValue).Owner<>Instance) and
                 (TComponent(ObjValue).Owner <> nil)) then //23.12.07 mse
            begin
"

Martin



More information about the fpc-devel mailing list