I just found this nasty bug deep in the iOS RTL of #10Seattle:
I just found this nasty bug deep in the iOS RTL of #10Seattle:
"function CocoaPointerConst is not thread-safe"
https://quality.embarcadero.com/browse/RSP-12465
The issue is that this function is called from CocoaNSStringConst which itself is called all over the place in the iOS RTL, making threaded solutions - well, let´s say challenging.
"function CocoaPointerConst is not thread-safe"
https://quality.embarcadero.com/browse/RSP-12465
The issue is that this function is called from CocoaNSStringConst which itself is called all over the place in the iOS RTL, making threaded solutions - well, let´s say challenging.
Sounds like fun.
ReplyDeleteIsn't it the same in unit Macapi.Foundation for OSX? :(
ReplyDeleteA simple FrameworkDic.Monitor use may fix it...
ReplyDeleteThe bug report doesn't have much info in it - could you explain what it's doing and why it's not thread-safe please? I don't know what CocoaPointerConst() does (and Delphi isn't running right now) but it sounds like a simple cast or conversion... which should be safe...
ReplyDeleteDavid Millington If it only were that simple! The function keeps track of loaded modules in a global TDictionary variable. The race condition occurs inside an `if not TryGetValue then LoadAndAdd` construct. There is also an `if var=nil then Create` construct, but that is probably executed quite early before any threads are involved.
ReplyDeleteWe'll look into this.
ReplyDelete