Try your code by enabling NSZombies (Add NSZombieEnabled=YES to the
environment before launching your tool/app).
This should show you what object is supposed to get messaged. I suspect some
object observes your notification but is deallocated.

-- 
Julien

On Tue, Oct 7, 2008 at 4:28 PM, Karan, Cem (Civ, ARL/CISD) <
[EMAIL PROTECTED]> wrote:

> I'm having a great deal of trouble getting my notification queue to work
> correctly.  It always causes a EXC_BAD_ACCESS
> whenever I post using NSPostASAP or NSPostWhenIdle, but it works when I
> post using NSPostNow.  Here are the relevant lines of code:
>
> -(void) testMethod
> {
>    NSNotification *tempNotification = [NSNotification
> notificationWithName:@"DummyName" object:self userInfo:nil];
>
>    [[NSNotificationQueue defaultQueue] enqueueNotification:tempNotification
> postingStyle:NSPostNow
>        coalesceMask:(NSNotificationCoalescingOnName |
> NSNotificationCoalescingOnSender) forModes:nil];
> }
>
> If I change NSPostNow to NSPostASAP, then it immediately crashes.  In the
> last crash, the stack looked like this:
>
> #0      0x964e6688 in objc_msgSend
> #1      0x931731da in _nsnote_callback
> #2      0x90722aba in __CFXNotificationPost
> #3      0x90722d93 in _CFXNotificationPostNotification
> #4      0x931a071c in -[NSNotificationCenter postNotification:]
> #5      0x931d3121 in postQueueNotifications
> #6      0x9073f9c2 in __CFRunLoopDoObservers
> #7      0x90740d1c in CFRunLoopRunSpecific
> #8      0x90741cf8 in CFRunLoopRunInMode
> #9      0x94902480 in RunCurrentEventLoopInMode
> #10     0x949021d2 in ReceiveNextEventCommon
> #11     0x9490210d in BlockUntilNextEventMatchingListInMode
> #12     0x9580b3ed in _DPSNextEvent
> #13     0x9580aca0 in -[NSApplication
> nextEventMatchingMask:untilDate:inMode:dequeue:]
> #14     0x95803cdb in -[NSApplication run]
> #15     0x957d0f14 in NSApplicationMain
> #16     0x0000a7fe in main at main.mm:13
>
> The precise line I get the EXC_BAD_ACCESS is:
>
> 0x964e6688  <+0024>  mov    0x20(%edx),%edi
>
> and this seems to happen at the end of the runloop.  I tried removing the
> coalesceMask arguments, but no luck.  Note that NSPostNow causes all the
> code to work completely correctly, its just the other two modes that it
> doesn't work.  Anyone have any clue what is going on?
>
> This is on a OS X 10.5.5 machine with MacFUSE 1.7 installed.  The code is
> being compiled using Xcode 3.1.1.
>
> Thanks,
> Cem Karan
>
> _______________________________________________
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/jjalon%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to