The address of a thread-local variable may change when a COM virtual function is called???
Before calling the QueryInterface
Calling the QueryInterface
[C++] The address of a thread-local variable may change when a COM function is called?
Re: [C++] The address of a thread-local variable may change when a COM function is called?
Do you mean &g? ThreadLocalStoragePointer does not change.
AFAIK g changes because it is called in new pseudo thread.
Can you provide example code.
AFAIK g changes because it is called in new pseudo thread.
Can you provide example code.
Re: [C++] The address of a thread-local variable may change when a COM function is called?
Code: Select all
ahk := ComObject("AutoHotkey2.Script")
threadid := ahk.NewThread("Persistent`na := 0 ")
Sleep 100
ahk.ahkAssign(threadid, 'a', [55])
An object outside a dll module enters the dll module of the same thread through the com interface, and then ThreadLocalStoragePointer of the DLL module has been replaced with another thread, and then calls QueryInterface, and the thread local variables are overwritten. But unable to find the source of this rewritten thread local variable from the known threads.
Perhaps the new thread local variable from the exe module in the thread corresponding to the current ThreadLocalStoragePointer.
Re: [C++] The address of a thread-local variable may change when a COM function is called?
Yes in that case the thread will be from exe.
Who is online
Users browsing this forum: No registered users and 2 guests