1

Topic: Proxy storage in GIT

All greetings. In the course of an industrial burning loss the following construction was born. There is a com-class and there are two flows, both STA. The following is fulfilled: 1. The flow 1 creates object of a com-class 2. The pointer on object  in a flow 2 (through  though it is unimportant). 3. The flow 2 puts the received proxy in GIT. 4. Received  from GIT it is transferred in a flow 1. 5. All flows release the received pointers, and a flow 1 (!) Withdraws registration in GIT. After that the message comes to a flow 2 0x406 (WM_USER+6) for window OleMainThreadWndClass. All anything, but is a singularity. If all procedure to make simultaneously with several objects messages comes as much. They also come recursively, i.e. each following message are processed from the output agent previous. As a result, if the amount of objects exceeds some limit the flow 2 lays down with stack overlflow. The circuit of actions looks strange, but all actions are explicitly resolved in MSDN: a step 3 The interface pointer may be a pointer to an in-process object, or it may be a pointer to a proxy for an object residing in another apartment, in another process, or on another computer. A step 5 This method can be called by any apartment in the process, including apartments other than the one that registered the interface in the global interface table. When the flow 1 causes RevokeInterfaceFromGlobal, GIT defines that specified cookie has been registered in other apartment, and transfers a call in this apartment. For this purpose there is object CGIPMessageParam which is put in a certain queue (CComApartment:: QueueMessage) and further message sending 0x406 through PostMessage (i.e. asynchronously is fulfilled!). What the output agent of the message in a flow 2 I does I do not know, but I suppose, what GIT in a flow 2 defines, what the withdrawn interface is a proxy on object from a flow 1, and transfers a call (Release?) in a flow 1, but already synchronously. In the course of waiting the cycle of messages which selects the following asynchronous message 0x406 is twisted, and the output agent causes itself.