Re: Interface Question



Rob Kennedy wrote:

But note that you can't *fully* disable reference counting. You can change _Release to not destroy the object, but you can't tell the compiler not to call _AddRef and _Release at all.

Correct.

So if you free the object by calling Free, you need to be certain that there are no dangling interface references for that object. If there are, then _AddRef or _Release will eventually be called for the object that has already been destroyed, and that's the same problem you have even if you _don't_ "disable" reference counting.

Just _AddRef and _Release cannot cause problems, because the non-counting versions don't access the object. Calling other methods may cause trouble, of course.

DoDi
.



Relevant Pages

  • Re: Interface Question
    ... change _Release to not destroy the object, ... compiler not to call _AddRef and _Release at all. ... dangling interface references for that object. ... Calling other methods ...
    (comp.lang.pascal.delphi.misc)
  • Re: Challenges from challenge-response systems qualify as unsolicited
    ... >> diminish, if not completely destroy, your credibility by your name ...
    (comp.os.linux.misc)
  • [PATCH] ReiserFS: Make sure all dentries refs are released before calling kill_block_super()
    ... Make sure all dentries refs are released before calling kill_block_superso ... that the assumption that generic_shutdown_supercan completely destroy the ... This prevents the BUG_ONin the reduced-locking dcache destroyer patch from ... I've tested this patch by creating a ReiserFS partition, ...
    (Linux-Kernel)
  • Re: Derived destructor not being called
    ... You can only destroy objects - interfaces are ethereal things that do not ... and calling Releaseon that same IBase* pointer in ... Each object needs to store it's own reference count. ...
    (microsoft.public.vc.language)
  • Re: Peak Oil - counterargument
    ... has a tendency to turn a reasonable discussion into silly ... name calling. ... I think he was suggesting that you find another thread to ... destroy, ...
    (rec.boats)