On Tue, 2005-01-04 at 15:27 -0600, Robert Shearman wrote:
Because inits should be thread-local, not apartment scoped. NtCurrentTeb()->ReservedForOle should be set to NULL when the matching CoUninitialize is called, not when the apartment is destroyed.
I was under the impression that CoSetState/*ErrorInfo weren't tied to apartments at all, hence the whole uninitialised apartments thing. So it's not right to set ReservedForOle to NULL when CoUninitialise is called with this patch because ReservedForOle now points to a struct oletls not an apartment (which should be refcounted so CoUninitialise in the MTA doesn't trigger its destruction).
That does leave the question of how to free the OLE TLS data though. Presumably in a THREAD_DETACH notification.