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.

Comments

  1. Isn't it the same in unit Macapi.Foundation for OSX? :(

    ReplyDelete
  2. A simple FrameworkDic.Monitor use may fix it...

    ReplyDelete
  3. The 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...

    ReplyDelete
  4. David 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.

    ReplyDelete

Post a Comment