Why am I getting a EXC_BAD_ACCESS in a NSTimer selector?
Posted
by AngeDeLaMort
on Stack Overflow
See other posts from Stack Overflow
or by AngeDeLaMort
Published on 2010-05-27T14:06:49Z
Indexed on
2010/05/27
14:11 UTC
Read the original article
Hit count: 230
I've got quite a weird problem. To make it short, i'll write some pseudo-code:
init: create a dictionary and insert n elements.
create a "repeat timer" and add it to the currentRunLoop using the timerRefresh selector.
timerRefresh: using a list of keys, find the items in the dictionary
if the item exists -> call a function
So, for an unknown reason, I get an EXC_BAD_ACCESS when I do:
[item function];
But I traced the address I got from the dictionary items and it's ok. The ref count of the items in the dictionary is still 1. The {release, dealloc} of the items in the dictionary aren't called. Everything seems fine. Also, to make it worst, it works for some items.
So, I'm wondering if there is a threading problem? or something else obscure?
The callstack is quite simple:
#0 0x93e0604b in objc_msgSend_fpret
#1 0x00f3e6b0 in ??
#2 0x0001cfca in -[myObject functionm:] at myObject.m:000
#3 0x305355cd in __NSFireTimer
#4 0x302454a0 in CFRunLoopRunSpecific
#5 0x30244628 in CFRunLoopRunInMode
#6 0x32044c31 in GSEventRunModal
#7 0x32044cf6 in GSEventRun
#8 0x309021ee in UIApplicationMain
#9 0x000027e0 in main at main.m:14
So, any suggestion where to look would be appreciated.
© Stack Overflow or respective owner