🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.ole
Article #21

CComObject and reference counting

#21
From: Thaddeus L. Olczyk
Date: Thu, 30 Jul 1998 00:00
14 lines
1091 bytes
Hi. In BCB I am instantiating a class via CComObject eq

CComObject<AImpl> *a =new  CComObject<AImpl>;

followed  by returning an interface pointer to a.
This created a lot of difficulties for me which I discovered from:

CComObject<AImpl> *a =new  CComObject<AImpl>;
a->AddRef();
a->Release();

which causes a to be deleted.
What's going on, it looks like a is created with refcount 0. Shouldn't
it be 1?
Technical Details
Message-ID: <35bfeef3.1377340@nntp.interaccess.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f9701,1d14f9d1d44ed69e,start
X-Google-Attributes: gidf9701,public
X-Google-Thread: 108cda,1d14f9d1d44ed69e,start
X-Google-Attributes: gid108cda,public
From: olczyk@interaccess.com (Thaddeus L. Olczyk)
Subject: CComObject and reference counting
Date: 1998/07/30
Message-ID: <35bfeef3.1377340@nntp.interaccess.com>
X-Deja-AN: 376218981
X-Complaints-To: newsabuse@supernews.com
X-Trace: 901771386 Z.COWSAII52C8CC94C usenet57.supernews.com
Organization: http://www.supernews.com, The World's Usenet: Discussions Start Here
Newsgroups: comp.os.ms-windows.programmer.ole,borland.public.cppbuilder.activex