COM automation

Hi,
I developed a local server(exe) with dual interface (using c++ ATL).
com is consumed by javascript in IE with "new activexobject".

However,
after calling to new activexobject the object in JS works fine but the reference counting in my c++ code increament several times and become 4.

so the local server is never shutdown till I close the IE browser.

I want to add a "ReleaseObj" function in my COM object so the javascript will be able to call it and release the object.

Is it safe to implemnt in this function a loop that call to release() till refcount is zero? is there another way?

Thanks
zadivad
The reference count is bumped up because the object is in use (4 instances). If you release the object while a client still has a reference to it, you're asking for trouble.
why it go to 4 instances if i only call one time to new activexobject from JS.
How can I implement Quit to free the object and cause the exe com server to shutdown.

It is not happened when I consume the object with CoCreateInstance via C++ client.
There's probably a leak in your JS client. I've always had these kinds of problems with web based technologies.

You could try repeating parts of the client use-case to where it's doing AddRef without the Release to determine where the leak is.
No, this is the regular behaviour of JS, it is due to add ref when creating stub and proxy and use the query interface. new activexobject does not release its instance, this is the behaviour, and that is why OLE deveoper implement Quit function like in Excel OLE object.

I realy appreciate your help, but if you are not familiar with this issue, maybe others know..

Thanks anyway.

Topic archived. No new replies allowed.