Leopard crash in standard open and save panel

  • Since upgrading to Leopard , I have noticed frequent crashes after
    entering a standard Cocoa open or save panel. It even happens in
    openDocument: command linked to Open... menu command that is built
    into NSApplication and I have not overridden that method. This same
    code has worked fine ever since 10.0. It seems worse building to
    "Current Mac OS" than to "10.4 (Universal)", but now I am seeing if in
    both bulds

    For example, this method (a target of a menu command) just crashed

    // save graphics to PDF file
    - (IBAction)saveGraphics:(id)sender
    {
        NSSavePanel *pan = [NSSavePanel savePanel];
        [pan setRequiredFileType:[self graphicsExtension]];
        [pan setTitle:@"Save Graphics"];
        [pan beginSheetForDirectory:nil file:nil
            modalForWindow:[self window] modalDelegate:self

    didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:)
            contextInfo:nil];
    }

    The sheet opens, but then crashes before I can interact with it. Part
    of crash log is below (full log is too long for this list)

    Process:        NairnFEAMPM [288]
    Path:            /Users/jnairn/Programming/Cocoa_Projects/NairnFEAMPM/
    build/Default/NairnFEAMPM.app/Contents/MacOS/NairnFEAMPM
    Identifier:      com.geditcom.NairnFEAMPM
    Version:        Version 1.6 (build 1)
    Code Type:      X86 (Native)
    Parent Process:  launchd [94]

    Date/Time:      2007-11-29 12:34:58.467 -0800
    OS Version:      Mac OS X 10.5.1 (9B18)
    Report Version:  6

    Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
    Exception Codes: KERN_INVALID_ADDRESS at 0x00000000c5ff271f
    Crashed Thread:  0

    Thread 0 Crashed:
    0  libobjc.A.dylib                   0x965126e8 objc_msgSend + 24
    1  com.apple.AppKit                 0x91de4834 -[NSTextStorage
    fontSetChanged] + 363
    2  com.apple.CoreFoundation         0x96b97da5 -[NSArray
    makeObjectsPerformSelector:] + 565
    3  com.apple.AppKit                 0x91de4661 +[NSTextStorage
    _fontSetChanged:] + 228
    4  com.apple.Foundation             0x918ad77c _nsnote_callback + 364
    5  com.apple.CoreFoundation         0x96b0aa4a __CFXNotificationPost +
    362
    6  com.apple.CoreFoundation         0x96b0ad23
    _CFXNotificationPostNotification + 179
    7  com.apple.Foundation             0x918aaa70 -[NSNotificationCenter
    postNotificationName:object:userInfo:] + 128
    8  com.apple.Foundation             0x918b4108 -[NSNotificationCenter
    postNotificationName:object:] + 56
    9  com.apple.AppKit                 0x92009e29 +[NSFont
    _postFontSetChangedNotifications] + 75
    10  com.apple.Foundation             0x918aec43 __NSThreadPerformPerform
    + 547
    11  com.apple.CoreFoundation         0x96b29698 CFRunLoopRunSpecific +
    3240
    12  com.apple.CoreFoundation         0x96b29d38 CFRunLoopRunInMode + 88
    13  com.apple.HIToolbox               0x9003b8a4
    RunCurrentEventLoopInMode + 283
    14  com.apple.HIToolbox               0x9003b5f6 ReceiveNextEventCommon +
    175
    15  com.apple.HIToolbox               0x9003b531
    BlockUntilNextEventMatchingListInMode + 106
    16  com.apple.AppKit                 0x91bacd5b _DPSNextEvent + 657
    17  com.apple.AppKit                 0x91bac6a0 -[NSApplication
    nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
    18  com.apple.AppKit                 0x91ba56d1 -[NSApplication run] + 795
    19  com.apple.AppKit                 0x91b729ba NSApplicationMain + 574
    20  com.geditcom.NairnFEAMPM         0x000023c6 _start + 216
    21  com.geditcom.NairnFEAMPM         0x000022ed start + 41

    ---------------
    John Nairn (1-541-737-4265, FAX:1-541-737-3385)
    Professor and Richardson Chair
    Web Page: http://woodscience.oregonstate.edu/faculty/Nairn
    FEA/MPM Web Page: http://oregonstate.edu/~nairnj
  • Hi,

    What happens is that the panel is added to the autoreleasepool and
    hence released after a release cycle. What you want to do is to add a
    [pan retain] in your saveGraphics method and a retain message in your
    savePanelDidEnd method. I think.

    /David

    On 30 nov 2007, at 22.34, John Nairn wrote:

    > Since upgrading to Leopard , I have noticed frequent crashes after
    > entering a standard Cocoa open or save panel. It even happens in
    > openDocument: command linked to Open... menu command that is built
    > into NSApplication and I have not overridden that method. This same
    > code has worked fine ever since 10.0. It seems worse building to
    > "Current Mac OS" than to "10.4 (Universal)", but now I am seeing if
    > in both bulds
    >
    > For example, this method (a target of a menu command) just crashed
    >
    > // save graphics to PDF file
    > - (IBAction)saveGraphics:(id)sender
    > {
    > NSSavePanel *pan = [NSSavePanel savePanel];
    > [pan setRequiredFileType:[self graphicsExtension]];
    > [pan setTitle:@"Save Graphics"];
    > [pan beginSheetForDirectory:nil file:nil
    > modalForWindow:[self window] modalDelegate:self
    > didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:)
    > contextInfo:nil];
    > }
    >
    > The sheet opens, but then crashes before I can interact with it.
    > Part of crash log is below (full log is too long for this list)
    >
    > Process:        NairnFEAMPM [288]
    > Path:            /Users/jnairn/Programming/Cocoa_Projects/
    > NairnFEAMPM/build/Default/NairnFEAMPM.app/Contents/MacOS/NairnFEAMPM
    > Identifier:      com.geditcom.NairnFEAMPM
    > Version:        Version 1.6 (build 1)
    > Code Type:      X86 (Native)
    > Parent Process:  launchd [94]
    >
    > Date/Time:      2007-11-29 12:34:58.467 -0800
    > OS Version:      Mac OS X 10.5.1 (9B18)
    > Report Version:  6
    >
    > Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
    > Exception Codes: KERN_INVALID_ADDRESS at 0x00000000c5ff271f
    > Crashed Thread:  0
    >
    > Thread 0 Crashed:
    > 0  libobjc.A.dylib                   0x965126e8 objc_msgSend + 24
    > 1  com.apple.AppKit                 0x91de4834 -[NSTextStorage
    > fontSetChanged] + 363
    > 2  com.apple.CoreFoundation         0x96b97da5 -[NSArray
    > makeObjectsPerformSelector:] + 565
    > 3  com.apple.AppKit                 0x91de4661 +[NSTextStorage
    > _fontSetChanged:] + 228
    > 4  com.apple.Foundation             0x918ad77c _nsnote_callback + 364
    > 5  com.apple.CoreFoundation         0x96b0aa4a __CFXNotificationPost
    > + 362
    > 6  com.apple.CoreFoundation         0x96b0ad23
    > _CFXNotificationPostNotification + 179
    > 7  com.apple.Foundation             0x918aaa70 -[NSNotificationCenter
    > postNotificationName:object:userInfo:] + 128
    > 8  com.apple.Foundation             0x918b4108 -[NSNotificationCenter
    > postNotificationName:object:] + 56
    > 9  com.apple.AppKit                 0x92009e29 +[NSFont
    > _postFontSetChangedNotifications] + 75
    > 10  com.apple.Foundation             0x918aec43
    > __NSThreadPerformPerform + 547
    > 11  com.apple.CoreFoundation         0x96b29698 CFRunLoopRunSpecific +
    > 3240
    > 12  com.apple.CoreFoundation         0x96b29d38 CFRunLoopRunInMode + 88
    > 13  com.apple.HIToolbox               0x9003b8a4
    > RunCurrentEventLoopInMode + 283
    > 14  com.apple.HIToolbox               0x9003b5f6 ReceiveNextEventCommon
    > + 175
    > 15  com.apple.HIToolbox               0x9003b531
    > BlockUntilNextEventMatchingListInMode + 106
    > 16  com.apple.AppKit                 0x91bacd5b _DPSNextEvent + 657
    > 17  com.apple.AppKit                 0x91bac6a0 -[NSApplication
    > nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
    > 18  com.apple.AppKit                 0x91ba56d1 -[NSApplication run] +
    > 795
    > 19  com.apple.AppKit                 0x91b729ba NSApplicationMain + 574
    > 20  com.geditcom.NairnFEAMPM         0x000023c6 _start + 216
    > 21  com.geditcom.NairnFEAMPM         0x000022ed start + 41
    >
    > ---------------
    > John Nairn (1-541-737-4265, FAX:1-541-737-3385)
    > Professor and Richardson Chair
    > Web Page: http://woodscience.oregonstate.edu/faculty/Nairn
    > FEA/MPM Web Page: http://oregonstate.edu/~nairnj
  • Sorry for the typo. It should be a release message in the
    savePanelDidEnd method.

    /David

    On 1 dec 2007, at 16.24, David Arve wrote:

    > Hi,
    >
    > What happens is that the panel is added to the autoreleasepool and
    > hence released after a release cycle. What you want to do is to add
    > a [pan retain] in your saveGraphics method and a retain message in
    > your savePanelDidEnd method. I think.
    >
    > /David
    >
    > On 30 nov 2007, at 22.34, John Nairn wrote:
    >
    >> Since upgrading to Leopard , I have noticed frequent crashes after
    >> entering a standard Cocoa open or save panel. It even happens in
    >> openDocument: command linked to Open... menu command that is built
    >> into NSApplication and I have not overridden that method. This same
    >> code has worked fine ever since 10.0. It seems worse building to
    >> "Current Mac OS" than to "10.4 (Universal)", but now I am seeing if
    >> in both bulds
    >>
    >> For example, this method (a target of a menu command) just crashed
    >>
    >> // save graphics to PDF file
    >> - (IBAction)saveGraphics:(id)sender
    >> {
    >> NSSavePanel *pan = [NSSavePanel savePanel];
    >> [pan setRequiredFileType:[self graphicsExtension]];
    >> [pan setTitle:@"Save Graphics"];
    >> [pan beginSheetForDirectory:nil file:nil
    >> modalForWindow:[self window] modalDelegate:self
    >> didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:)
    >> contextInfo:nil];
    >> }
    >>
    >> The sheet opens, but then crashes before I can interact with it.
    >> Part of crash log is below (full log is too long for this list)
    >>
    >> Process:        NairnFEAMPM [288]
    >> Path:            /Users/jnairn/Programming/Cocoa_Projects/
    >> NairnFEAMPM/build/Default/NairnFEAMPM.app/Contents/MacOS/NairnFEAMPM
    >> Identifier:      com.geditcom.NairnFEAMPM
    >> Version:        Version 1.6 (build 1)
    >> Code Type:      X86 (Native)
    >> Parent Process:  launchd [94]
    >>
    >> Date/Time:      2007-11-29 12:34:58.467 -0800
    >> OS Version:      Mac OS X 10.5.1 (9B18)
    >> Report Version:  6
    >>
    >> Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
    >> Exception Codes: KERN_INVALID_ADDRESS at 0x00000000c5ff271f
    >> Crashed Thread:  0
    >>
    >> Thread 0 Crashed:
    >> 0  libobjc.A.dylib                   0x965126e8 objc_msgSend + 24
    >> 1  com.apple.AppKit                 0x91de4834 -[NSTextStorage
    >> fontSetChanged] + 363
    >> 2  com.apple.CoreFoundation         0x96b97da5 -[NSArray
    >> makeObjectsPerformSelector:] + 565
    >> 3  com.apple.AppKit                 0x91de4661 +[NSTextStorage
    >> _fontSetChanged:] + 228
    >> 4  com.apple.Foundation             0x918ad77c _nsnote_callback + 364
    >> 5  com.apple.CoreFoundation         0x96b0aa4a __CFXNotificationPost
    >> + 362
    >> 6  com.apple.CoreFoundation         0x96b0ad23
    >> _CFXNotificationPostNotification + 179
    >> 7  com.apple.Foundation             0x918aaa70 -
    >> [NSNotificationCenter postNotificationName:object:userInfo:] + 128
    >> 8  com.apple.Foundation             0x918b4108 -
    >> [NSNotificationCenter postNotificationName:object:] + 56
    >> 9  com.apple.AppKit                 0x92009e29 +[NSFont
    >> _postFontSetChangedNotifications] + 75
    >> 10  com.apple.Foundation             0x918aec43
    >> __NSThreadPerformPerform + 547
    >> 11  com.apple.CoreFoundation         0x96b29698 CFRunLoopRunSpecific
    >> + 3240
    >> 12  com.apple.CoreFoundation         0x96b29d38 CFRunLoopRunInMode + 88
    >> 13  com.apple.HIToolbox               0x9003b8a4
    >> RunCurrentEventLoopInMode + 283
    >> 14  com.apple.HIToolbox               0x9003b5f6
    >> ReceiveNextEventCommon + 175
    >> 15  com.apple.HIToolbox               0x9003b531
    >> BlockUntilNextEventMatchingListInMode + 106
    >> 16  com.apple.AppKit                 0x91bacd5b _DPSNextEvent + 657
    >> 17  com.apple.AppKit                 0x91bac6a0 -[NSApplication
    >> nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
    >> 18  com.apple.AppKit                 0x91ba56d1 -[NSApplication run]
    >> + 795
    >> 19  com.apple.AppKit                 0x91b729ba NSApplicationMain + 574
    >> 20  com.geditcom.NairnFEAMPM         0x000023c6 _start + 216
    >> 21  com.geditcom.NairnFEAMPM         0x000022ed start + 41
    >>
    >> ---------------
    >> John Nairn (1-541-737-4265, FAX:1-541-737-3385)
    >> Professor and Richardson Chair
    >> Web Page: http://woodscience.oregonstate.edu/faculty/Nairn
    >> FEA/MPM Web Page: http://oregonstate.edu/~nairnj

previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today