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)
60
60
{
61
61
return e . HResult ;
62
62
}
63
- }
64
-
65
- ComCallData comCallData ;
66
- comCallData . dwDispid = 0 ;
67
- comCallData . dwReserved = 0 ;
63
+ }
68
64
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.
69
67
CallbackData . PerThreadObject = state ;
70
68
71
69
int hresult ;
@@ -81,6 +79,11 @@ static int InvokeCallback(ComCallData* comCallData)
81
79
callbackData . Callback = callback ;
82
80
callbackData . StatePtr = statePtr ;
83
81
82
+ ComCallData comCallData ;
83
+ comCallData . dwDispid = 0 ;
84
+ comCallData . dwReserved = 0 ;
85
+ comCallData . pUserDefined = ( IntPtr ) ( void * ) & callbackData ;
86
+
84
87
Guid iid = IID . IID_ICallbackWithNoReentrancyToApplicationSTA ;
85
88
86
89
// 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