On 20 Sep 2011, at 19:51, Mike Abdullah wrote:

> 
> On 20 Sep 2011, at 10:49, Gerriet M. Denkmann wrote:
> 
>> In my toy editor I open an existing document, modify it and click 
>> "Duplicate".
>> 
>> A Sheet comes down and tells me that the duplicate will contain my latest 
>> modifications.
>> I click the default "Duplicate" button and get:
>> 
>> 2011-09-20 16:29:43.164 TextEditor[4062:707] *** -[NSPathStore2 
>> stringByAppendingPathExtension:]: nil argument
>> 2011-09-20 16:29:43.213 TextEditor[4062:707] (
>>      0   CoreFoundation                      0x00007fff8742a986 
>> __exceptionPreprocess + 198
>>      1   libobjc.A.dylib                     0x00007fff80f84d5e 
>> objc_exception_throw + 43
>>      2   CoreFoundation                      0x00007fff8742a7ba 
>> +[NSException raise:format:arguments:] + 106
>>      3   CoreFoundation                      0x00007fff8742a744 
>> +[NSException raise:format:] + 116
>>      4   Foundation                          0x00007fff89d8a172 
>> -[NSPathStore2 stringByAppendingPathExtension:] + 112
>>      5   AppKit                              0x00007fff845808c3 -[NSDocument 
>> _preserveCurrentVersionForReason:error:] + 579
>>      6   AppKit                              0x00007fff84586bc3 
>> __-[NSDocument 
>> duplicateDocumentWithDelegate:didDuplicateSelector:contextInfo:]_block_invoke_3
>>  + 119
>>      7   AppKit                              0x00007fff845819a9 -[NSDocument 
>> _something:wasPresentedWithResult:soContinue:] + 21
>>      8   AppKit                              0x00007fff84472bee -[NSAlert 
>> didEndAlert:returnCode:contextInfo:] + 93
>>      9   AppKit                              0x00007fff8447f356 
>> -[NSApplication endSheet:returnCode:] + 275
>>      10  AppKit                              0x00007fff84472ab4 -[NSAlert 
>> buttonPressed:] + 265
>>      11  CoreFoundation                      0x00007fff8741a11d -[NSObject 
>> performSelector:withObject:] + 61
>>      12  AppKit                              0x00007fff842ce852 
>> -[NSApplication sendAction:to:from:] + 139
>>      13  AppKit                              0x00007fff842ce784 -[NSControl 
>> sendAction:to:] + 88
>>      14  AppKit                              0x00007fff842ce6af -[NSCell 
>> _sendActionFrom:] + 137
>>      15  AppKit                              0x00007fff844d758a 
>> -[NSButtonCell performClick:] + 594
>>      16  AppKit                              0x00007fff84337afd -[NSButton 
>> performKeyEquivalent:] + 368
>>      17  AppKit                              0x00007fff84337722 -[NSView 
>> _performKeyEquivalent:conditionally:] + 45
>>      18  AppKit                              0x00007fff8433796d -[NSControl 
>> _performKeyEquivalent:conditionally:] + 119
>>      19  AppKit                              0x00007fff84337850 -[NSView 
>> performKeyEquivalent:] + 155
>>      20  AppKit                              0x00007fff84473d06 
>> -[_NSAlertContentView performKeyEquivalent:] + 92
>>      21  AppKit                              0x00007fff84337722 -[NSView 
>> _performKeyEquivalent:conditionally:] + 45
>>      22  AppKit                              0x00007fff84337850 -[NSView 
>> performKeyEquivalent:] + 155
>>      23  AppKit                              0x00007fff84337722 -[NSView 
>> _performKeyEquivalent:conditionally:] + 45
>>      24  AppKit                              0x00007fff84337695 -[NSWindow 
>> performKeyEquivalent:] + 58
>>      25  AppKit                              0x00007fff8485caeb -[NSWindow 
>> keyDown:] + 74
>>      26  AppKit                              0x00007fff84297ad2 -[NSWindow 
>> sendEvent:] + 7404
>>      27  AppKit                              0x00007fff8422ff19 
>> -[NSApplication sendEvent:] + 5665
>>      28  AppKit                              0x00007fff841c642b 
>> -[NSApplication run] + 548
>>      29  AppKit                              0x00007fff8444452a 
>> NSApplicationMain + 867
>>      30  TextEditor                          0x0000000100001bc0 main + 32
>>      31  TextEditor                          0x0000000100001b94 start + 52
>>      32  ???                                 0x0000000000000001 0x0 + 1
>> )
>> 
>> TextEdit can duplicate a modified document without any problems.
>> 
>> So obviously my program does something not quite right.
>> But as there is hardly any of my own code in this backtrace, how can I debug 
>> this?
> 
> What NSDocument methods have you overridden?

Of the save stuff only:
- (id)fileWrapperOfType:(NSString *)typeName  error:(NSError **)outError 

and:
+ (BOOL)autosavesInPlace
returns YES.


> Do any of them get called during this routine?

None, as seen from the backtrace.
After the exception fileWrapperOfType... gets called, but then everything is 
already screwed up.

Gerriet.


_______________________________________________

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 arch...@mail-archive.com

Reply via email to