[PATCH 3/3] ole32: Call the appropriate storage function when we run the object.

Rob Shearman robertshearman at gmail.com
Wed Oct 22 06:46:39 CDT 2008


2008/10/21 Huw Davies <huw at 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;
>  }


-- 
Rob Shearman



More information about the wine-devel mailing list