File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
src/WinRT.Runtime/Interop Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -60,12 +60,10 @@ static int InvokeCallback(ComCallData* comCallData)
6060 {
6161 return e . HResult ;
6262 }
63- }
64-
65- ComCallData comCallData ;
66- comCallData . dwDispid = 0 ;
67- comCallData . dwReserved = 0 ;
63+ }
6864
65+ // Store the state object in the thread static to pass to the callback.
66+ // We don't need a volatile write here, we have a memory barrier below.
6967 CallbackData . PerThreadObject = state ;
7068
7169 int hresult ;
@@ -81,6 +79,11 @@ static int InvokeCallback(ComCallData* comCallData)
8179 callbackData . Callback = callback ;
8280 callbackData . StatePtr = statePtr ;
8381
82+ ComCallData comCallData ;
83+ comCallData . dwDispid = 0 ;
84+ comCallData . dwReserved = 0 ;
85+ comCallData . pUserDefined = ( IntPtr ) ( void * ) & callbackData ;
86+
8487 Guid iid = IID . IID_ICallbackWithNoReentrancyToApplicationSTA ;
8588
8689 // Add a memory barrier to be extra safe that the target thread will be able to see
You can’t perform that action at this time.
0 commit comments