[fpc-pascal] interface "is" patch (finished and included)

ml at brainwashers.org ml at brainwashers.org
Sat Apr 2 16:44:44 CEST 2005


Quoting Florian Klaempfl <florian at freepascal.org>:

> ml wrote:
> 
> > i included again my refcount patch (haven't got even a little response
> > on it. i'm slowly starting to wonder if i'm on the right mailing list
> > (usually devel list is for internal purposes of regular developers, and
> > others are... well,... for others (as well as bug reporting as
> > patches)), i got more response on C operators (which i didn't even asked
> > in fact) than on my first patch and error reports in interfaces)
> 
> Sorry, currently I'am very busy with work and life ;( and I've still
> some other patches pending to review ...
> 
> > diff -ruN fpc-1.9.8-patched/rtl/inc/objpas.inc
> fpc-1.9.8-devel/rtl/inc/objpas.inc
> > --- fpc-1.9.8-patched/rtl/inc/objpas.inc	2005-03-27 20:09:37.000000000
> +0200
> > +++ fpc-1.9.8-devel/rtl/inc/objpas.inc	2005-03-28 21:17:14.000000000 +0200
> > @@ -607,7 +607,7 @@
> >            IEntry:=getinterfaceentry(iid);
> >            if Assigned(IEntry) then begin
> >              PPointer(@obj)^:=Pointer(Self)+IEntry^.IOffset;
> > -            intf_incr_ref(pointer(obj)); { it must be an com interface }
> > +//            intf_incr_ref(pointer(obj)); { it must be an com interface
> }
> >              getinterface:=True;
> >            end
> >            else begin
> > @@ -623,8 +623,8 @@
> >            IEntry:=getinterfaceentrybystr(iidstr);
> >            if Assigned(IEntry) then begin
> >              PPointer(@obj)^:=Pointer(Self)+IEntry^.IOffset;
> > -            if Assigned(IEntry^.iid) then { for Com interfaces }
> > -              intf_incr_ref(pointer(obj));
> > +//            if Assigned(IEntry^.iid) then { for Com interfaces }
> > +//              intf_incr_ref(pointer(obj));
> 
> Any examples when this causes problems/why it is removed?

Yeah, here is a no brainerr.

type
  IA = interface
   ['{GUID NUMBER HERE']
   procedure A;
  end;

  TA = class(TInterfacedObject,IA)
    procedure A;
  end;

procedure TA.A;
begin
end;

var
  a,c: IA;
  b:TA;
begin
  b := TA.Create;
  a := b;
  c := b;
  a := b;
  c := b;
  a := b;
  c := b;
  a := b;
  c := b;
  Writeln('refount is ': b.refcount);
end.

Sorry, but I'm on public terminal 
Refcount will be correct if guid won't be specified, but as soon as you specify,
well you'll see

> 
> >              getinterfacebystr:=True;
> >            end
> >            else begin
> > 
> > 
> > ------------------------------------------------------------------------
> > 
> > _______________________________________________
> > fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> > http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> 
> 
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> 




----------------------------------------------------------------------
This mail sent through Horde-Toaster (http://qmailtoaster.clikka.com/)




More information about the fpc-pascal mailing list