Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2005-03

Interfaces again (patch for refcount)

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

ml

RefCount isn't handled correctly if guid 0, obviously tests were for guid 0 only (either when I create guid with md5 or specify in interface type as {C35224FA-ED88-0D1C-A4D2-FCF91AC4C8C6})

// always using same two variables, and notice all possible calls
// do the same error with counting one too much
  obj := TSomeClass.Create;
  Writeln('ref:', (obj as TInterfacedObject).RefCount); //count=0
  a := obj; aa := (a as IA);
  Writeln('ref:', (obj as TInterfacedObject).RefCount); //count=3
  a := obj;
  Supports(a, IA, aa);
  obj.GetInterface(IA, aa);
  obj.GetInterface(IA, aa);
  obj.GetInterface(IA, aa);
  Writeln('ref:', (obj as TInterfacedObject).RefCount); //count=7

OUTPUT:
TSomeClass.Create
ref:0
ref:3
ref:7

Just as soon as you apply simple patch (included), everything works like it should

OUTPUT (after patch):
TSomeClass.Create
ref:0
ref:2
ref:2

Raw Magick DOT COM
to ml

Hi All,

I see patches being released here, though I dont quite yet get how to apply them, I have just downloaded source and make'd it using FPC. I was wondering if these patches were automatically applied to that evenings build of the sources and if not how often were the patches applied.

Peter Dove

Florian Klaempfl
to Raw Magick DOT COM: I see patches being released here, though I dont quite yet get how to apply them, I have…
Raw Magick DOT COM wrote 7 lines
Hi All, I see patches being released here, though I dont quite yet get how to apply them, I have just downloaded source and make'd it using FPC. I was wondering if these patches were automatically applied to that evenings build of the sources and if not how often were the patches applied.

They aren't "automatically" applied but the people with cvs write access usually apply them within several days so they get into the downloadable sources.

Show quoted text 7 lines
Peter Dove _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal