Sep 7, 2012 at 4:59am UTC
I developed a local server(exe) with dual interface (using c++ ATL).
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.
Is it safe to implemnt in this function a loop that call to release() till refcount is zero? is there another way?
Sep 7, 2012 at 11:31am UTC
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.
Sep 7, 2012 at 1:51pm UTC
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.
Sep 7, 2012 at 3:07pm UTC
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.
Sep 7, 2012 at 3:14pm UTC
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..