Xcode 13 causing a CFRunLoopRun crash

With Xcode 12 the following lines of code had been working fine :

     CFRunLoopSourceRef runloop = CFMessagePortCreateRunLoopSource(kCFAllocatorDefault, this->m_localPort, 0);
    CFRunLoopAddSource(CFRunLoopGetCurrent(), runloop, kCFRunLoopCommonModes);
    CFRunLoopRun();

Xcode 13 is basically causing this to crash at CFRunLoopRun with the following error :

[CFData release]: message sent to deallocated instance 0x281013cf0

It looks like something got released earlier than it should have.

This works fine with Xcode 12 though. I am assuming this should be a bug, but is there anything I can do to verify this or pin point what exactly is wrong.

It looks like something got released earlier than it should have.

Yes.

This works fine with Xcode 12 though.

That doesn’t necessary mean anything. It’s common for bugs like this to come and go based on the exact tools and system configuration in play.

message sent to deallocated instance

That specific messages suggests that you have Zombies enabled. If you run with the Zombies instrument, you should be able to see all the memory events (init, retain, release, dealloc) for that object and use that to guide your investigation.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I was able to figure this out.

The AutoReleasePool was basically releasing memory. I had to disable ARC for that file, to get past the error.

But don't understand why this would be kicked in by Xcode 13, and why this was never an error in the first place in the previous Xcode versions.

But don't understand why this would be kicked in by Xcode 13

This sort of thing is relatively common, for example, when the compiler’s optimiser gets better at releasing unused references.

As to what’s causing it in your specific situation, it’s hard to say without more specific details about the problem. Can you post a snippet that reproduces the issue?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Xcode 13 causing a CFRunLoopRun crash
 
 
Q