On OS X 10.7 the following is crashing on occasion in a GC app when the path 
contains an RTFD document:
On SL the issue does not occur.

NSAttributedString *atext = [[NSAttributedString alloc] initWithPath:Path 
documentAttributes:NULL];


The kernel log states:
01/08/2011 09:44:29.000 kernel: Data/Stack execution not permitted: 
MondayApp[pid 59614] at virtual address 0xfefff000, protections were read-write

I have tried disabling the collector without effect.
The code is used to load an RTFD file resource and often loads the resource 
without issue.
The crash is repeatable in the sense that it occurs when the code is triggered 
by particular set of bindings.
Other non RTFD file resources are loaded at the same time and load without 
issue.
The path is okay.

The following workaround seems reliable:

// get path to rtf file
NSString *filePath = [path stringByAppendingPathComponent:@"TXT.rtf"];
            
// get data
NSData *data = [NSData dataWithContentsOfFile:filePath options:0 
error:&docError];
                
// get attributed string
if (!docError) {
        atext = [[NSAttributedString alloc] initWithData:data options:nil 
documentAttributes:NULL error:&docError];
}

This might work for anyone else hitting this issue.

0x95c48d61  <+0000>  push   %ebp
0x95c48d62  <+0001>  mov    %esp,%ebp
0x95c48d64  <+0003>  push   %esi
0x95c48d65  <+0004>  sub    $0x24,%esp
0x95c48d68  <+0007>  call   0x95c48d6d 
<-[NSAttributedString(NSAttributedStringKitAdditions) 
initWithPath:documentAttributes:]+12>
0x95c48d6d  <+0012>  pop    %esi
0x95c48d6e  <+0013>  mov    0x16b37697(%esi),%eax
0x95c48d74  <+0019>  mov    0x16b26803(%esi),%ecx
0x95c48d7a  <+0025>  mov    0x10(%ebp),%edx
0x95c48d7d  <+0028>  mov    %edx,0x8(%esp)
0x95c48d81  <+0032>  mov    %ecx,0x4(%esp)
0x95c48d85  <+0036>  mov    %eax,(%esp)
0x95c48d88  <+0039>  call   0x962937e2 <dyld_stub_objc_msgSend>
0x95c48d8d  <+0044>  mov    0x16b26dd3(%esi),%ecx
0x95c48d93  <+0050>  mov    0x14(%ebp),%edx
0x95c48d96  <+0053>  mov    %edx,0x10(%esp)
0x95c48d9a  <+0057>  mov    %eax,0x8(%esp)
0x95c48d9e  <+0061>  mov    %ecx,0x4(%esp)
0x95c48da2  <+0065>  mov    0x8(%ebp),%eax
0x95c48da5  <+0068>  mov    %eax,(%esp)
0x95c48da8  <+0071>  movl   $0x0,0x14(%esp)
0x95c48db0  <+0079>  movl   $0x0,0xc(%esp)
0x95c48db8  <+0087>  call   0x962937e2 <dyld_stub_objc_msgSend>
0x95c48dbd  <+0092>  add    $0x24,%esp <<-- program received signal 
EXC_BAD_ACCESS
0x95c48dc0  <+0095>  pop    %esi
0x95c48dc1  <+0096>  pop    %ebp
0x95c48dc2  <+0097>  ret    

Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.com







_______________________________________________

Cocoa-dev mailing list ([email protected])

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