Hi developers,

as one or the other knows, OOo does not only run on Unix and relatives, but ... also on Windows :-), and it actually tries hard to integrate well.

Some things on Windows are provided as COM/OLE services, which may not play nice with our current initialization of COM in SAL threads.

Initializing COM or OLE makes COM / OLE implementations usable in the current thread, meaning that the initialization is bound to the calling thread.

COM basically supports two threading models, called STA for Single Threaded Apartment respectively MTA for Muti Threaded Apartment. (The extended Uno threading model introduces something similar to Uno, (certainly :-) being more flexible, see http://wiki.services.openoffice.org/wiki/Uno/Effort/Binary/Extend_Threading-Model for details.) OLE sits on top of COM, but only supports STAs, initializing OLE implicitly initializes COM with the STA model.

COM Initialization functions:
- CoInitialize
- CoInitializeEx
- CoUninitializ

OLE Initialization functions:
- OleInitialize
- OleUninitialize

COM objects of different STAs may not be mixed with each other and may not be called by other threads (than the ones which did the retrieval respectively the initialization). Same holds true for OLE because OLE relying on COM (see above). STA and MTA objects may not be mixed as well.

Taking a look at OOo wrt COM and OLE shows, that the VCL initializing thread (the "main" thread) does initialize COM as well (see vcl/win/source/app/salinst.cxx:485), in particular as STA.

Looking into SAL we see, that every SAL thread initializes COM as MTA, before actually calling the worker function (see sal/osl/w32/thread.c:77).

While it is more or less OK to let the "main" thread do some COM initialization (at least currently, more to come later :-), it is somewhat unpleasant for the SAL threads to also do so,
- as a SAL thread not necessarily needs to do any COM stuff,
- as it conflicts with any OLE usage, and
- as it makes it easy to hurt object separation as outlined above, may be breaking apartment integrity.

To make a long story short, I plan to remove the COM initialization from SAL threads, which unfortunately is an incompatible change. Certainly I am going to take care of our current implementations, to adapt them appropriately.

This change is already aligned with Hennes and Ollie.

Comments?

  Kay

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to