Quantcast
Channel: Cocoanetics
Viewing all articles
Browse latest Browse all 428

Radar: Enumerating NSAttributedString Attributes on Multiple Threads causes EXC_BAD_ACCESS

$
0
0

This bug has been causing me grief for the last month or so, as it was hard to pin down without a concrete use case that can reliably reproduce it. GitHub user brovador finally was able to narrow it down to be able to repro it every time.

There appears to be a bug in NSAttributedString that causes an EXC_BAD_ACCESS if you try to enumerate certain attributes over a longer range on two separate attributed strings from two background threads.

I filed it as rdar://15139980 and on Open Radar. The sample is the DTCoreTextExceptionExample on our Radar Samples GitHub repo.

Summary

If you enumerate attributes on two different NSAttributedString instances on two background threads an EXC_BAD_ACCESS is caused by -attribute:atIndex:effectiveRange: method.

Steps to Reproduce

Launch the provided sample app.

Expected Results

There should be no crash.

Actual Results

The app crashes showing two crashed threads at DTCoreTextLayoutFrame.m:949.

I’m enclosing a screen shot of the crash.

If you enable the the synchronization at line 939 then the crash no longer occurs.

Version

7.0 (11A465)

Notes

This bug was also present in iOS 6.

Configuration

iOS 7 Simulator

NSAttributedStrings enumeration crash

flattr this!


Viewing all articles
Browse latest Browse all 428

Trending Articles