Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.14.2
-
None
Description
Please reference attached "test case.txt" for a simple test case of the `QThread`, and "call stack.txt" to show the call stack of the data race reported in the simple test case. Please enable `tsan` for reproducing it.
`QMetaObject::invokeMethod` is causing data race if the object belongs to another `QThread`, and the `QThread` is being started.
In the `QThread` implementation for `unix`, there is some initialization work (preparing event dispatcher, etc.) not guarded by mutex, and if the `QThread` is creating event dispatcher, and another thread is calling `wakeUp` because of `postEvent`, 2 threads are accessing the data at the same time.
The stack trace has pointed out the data race is in "qeventdispatcher_unix.cpp:181".