2008/10/21 Huw Davies huw@codeweavers.com:
@@ -1728,6 +1767,10 @@ static HRESULT WINAPI DefaultHandler_IPersistStorage_HandsOffStorage( if(SUCCEEDED(hr) && object_is_running(This)) hr = IPersistStorage_HandsOffStorage(This->pPSDelegate);
- old_stg = InterlockedExchangePointer((void**)&This->storage, NULL);
IIRC, the default handler is apartment-threaded only, meaning that a default handler object cannot be used on a thread other than the one it was created on. Adding constructs like this introduce confusion to future developers about whether the code is or isn't thread-safe and so it should be avoided and a non-thread-safe construct used instead.
- if(old_stg) IStorage_Release(old_stg);
- This->storage_state = storage_state_uninitialised;
- return hr;
}