Com Server

Hi,

I have two COM objects interacting as shown below.

Client –> Com Obj1 –> Com obj2 -|
| |
<----| <---------------|

The backward arrow shows the connection from server to client which are
using connection points (for source/sink implementation).

My problem is When my Com Obj2 dies because of say e.g. exception …
Com Obj1 could tell Client that Com Obj2 has died abruptly…
But when my Client Releases Com Obj1 it couldnt go out of memory.
(Both Com Objects are out of proc servers).

I guess the problem is because of the refrence counting mechanism due to
connection points which I tried to verify with no success.

Could anyone here tell me the way i could successfully release my Com Obj1
even if COm Obj2 dies abruptly.

Thanx,
Manish

> Could anyone here tell me the way i could successfully release my Com Obj1

even if COm Obj2 dies abruptly.

Try to use weak references to your connection points - the pointer which
does not have AddRef on it. The same is - do not pay any attention to the
reference counts on connection points, allocate them in a specific way and
make ComObj1 responsible for their allocation.

Or - have the ComObj1 and the connection point as different COM objects with
separate reference count. In this case, if ComObj2 dies, then:

  • you can easily release ComObj1, it will have zero reference
  • the connection point will still have a reference from ComObj2 - it will
    last since DCOM will understand the client’s death and will release the
    connection point.

This seems to be only ways to resolve the circular dependencies in COM
objects like your case.

Max