Re: performSelectorOnMainThread fails second time through
Re: performSelectorOnMainThread fails second time through
- Subject: Re: performSelectorOnMainThread fails second time through
- From: Gideon King <email@hidden>
- Date: Wed, 8 Dec 2010 20:27:02 +1000
You are correct. They are two different things:
Broken on CFRunLoopWakeUp:
(gdb) po $rdi
<CFRunLoop 0x101e04390 [0x7fff70188ee0]>{locked = false, wakeup port = 0x5c03, stopped = false,
current mode = (none),
common modes = <CFBasicHash 0x101e043f0 [0x7fff70188ee0]>{type = mutable set, count = 1,
entries =>
2 : <CFString 0x7fff70166390 [0x7fff70188ee0]>{contents = "kCFRunLoopDefaultMode"}
}
...
(gdb) po (void*)CFRunLoopGetMain()
<CFRunLoop 0x1019006e0 [0x7fff70188ee0]>{locked = false, wakeup port = 0x1d03, stopped = false,
current mode = kCFRunLoopDefaultMode,
common modes = <CFBasicHash 0x101900490 [0x7fff70188ee0]>{type = mutable set, count = 3,
entries =>
0 : <CFString 0x7fff70f7c0f8 [0x7fff70188ee0]>{contents = "NSModalPanelRunLoopMode"}
1 : <CFString 0x7fff70f7c118 [0x7fff70188ee0]>{contents = "NSEventTrackingRunLoopMode"}
2 : <CFString 0x7fff70166390 [0x7fff70188ee0]>{contents = "kCFRunLoopDefaultMode"}
}
...
Thanks for offering to look into this further.
Gideon
On 08/12/2010, at 8:16 PM, Dave Keck wrote:
>> That was the output for $rdi at the CGRunLoopWakeUp breakpoint immediately after the call to performSelectorOnMainThread...
>
> Sorry, realized that after I sent. The output still isn't what I would
> expect though: on my system, the run loop supplied to
> CFRunLoopWakeUp() from within the -performSelectorOnMainThread stack
> frame is the main run loop (as you'd expect), and the description of
> the main run loop should be quite similar to what I posted at the
> pastie link. The description of the run loop you posted (with address
> 0x1a2ac80) doesn't look like the main run loop at all. Therefore I'm
> _guessing_ that the problem is that -performSelectorOnMainThread is
> both attaching its CFRunLoopSource and calling CFRunLoopWakeUp() on
> the wrong run loop.
>
> It'd be worth verifying whether the CFRunLoopRef supplied to
> CFRunLoopWakeUp() within the -performSelectorOnMainThread stack frame
> is the same pointer returned by CFRunLoopGetMain(). Let me know and if
> it's not, and I'll look further into the NSObject/NSThread disassembly
> to see where it might be getting the incorrect CFRunLoop reference.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden