I fixed a rather nasty bug today in AspectObjectiveC. One particular unit
test would crash with EXC_BAD_ACCESS
every time. After learning far more
about registers and ABIs than I ever wanted to know (thanks, Greg Parker),
it dawned on me that performSelector:
was corrupting memory. It was
particularly hard to track down because the crash would happen a couple of
lines after the call to performSelector:
, when the corrupted memory was
actually accessed.
I’ve never had a problem with performSelector:
before, but this time I was
using it a little differently. The return value of the selector was an
NSRect
.
Now for the gory explanation.