On 8 Jan 2010, at 11:35, jonat...@mugginsoft.com wrote:

> My GC app has two NSTextViews in two windows.
> Distinct attributed text can loaded into both NSTextView instances.
> 
> The problem test text data size  is 2MB.
> The problem does not manifest itself for smaller data sizes.
> 
> The 2MB test data can be loaded repeatedly into a single NSTextView instance 
> without issue.
> When the same test data is loaded into the second NSTextView instance the 
> crash occurs.
> 
> Obviously NSLayoutManager has initiated deferred layout.
> Do I have to be aware of any particular layout manager issues in this case?
> 
> I am not doing any manipulation of the NSTextView contents.
> The content is established using the following binding.
> 
> [_textView bind:NSAttributedStringBinding 
>                  toObject:self 
>               withKeyPath:@"resultString" 
>                       options:[NSDictionary dictionaryWithObjectsAndKeys: 
> [NSNumber numberWithBool:YES], NSConditionallySetsEditableBindingOption, 
> nil]];
> 
> 
This issue may be related to garbage collection.
I was initiating [[NSGarbageCollector defaultCollector]collectExhaustively] 
after the end of a particular operation.
Removing this greatly reduced but did not wholly eliminate the problem.

What did have a positive effect was to to configure the NSTextView instances as 
-setAllowsNonContiguousLayout:YES
Presumably this initiates a different code path.

As a precautionary measure I also turned off background layout. 
[[myText layoutManager] setBackgroundLayoutEnabled:NO];

> Crash details follow.
> 
> Thanks
> 
> Jonathan
> 
> Date/Time:       2010-01-08 11:11:32.074 +0000
> OS Version:      Mac OS X 10.6.2 (10C540)
> Report Version:  6
> 
> Exception Type:  EXC_BAD_ACCESS (SIGBUS)
> Exception Codes: KERN_PROTECTION_FAILURE at 0x000000000000017c
> Crashed Thread:  0  Dispatch queue: com.apple.main-thread
> 
> Application Specific Information:
> objc[653]: garbage collection is ON
> 
> Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
> 0   com.apple.AppKit                  0x92eadd3e -[NSATSGlyphStorage 
> setAbsorbedCount:forIndex:] + 84
> 1   com.apple.CoreText                0x95cbf9e3 
> TObjCGlyphStorage::SetAttachmentCount(long, long) + 51
> 2   com.apple.CoreText                0x95cbf8b0 long 
> TRun::SetAttachmentsLeftToRight<true>(long, long const*, long) + 402
> 3   com.apple.CoreText                0x95cbf6a8 TRun::DeleteGlyphs(long, 
> long const*, long) + 60
> 4   com.apple.CoreText                0x95cbf5c1 TLine::DeleteGlyphs(long, 
> long, long const*) + 243
> 5   com.apple.CoreText                0x95cab05f 
> TShapingEngine::ShapeGlyphs(TLine&, TCharStream const&) + 647
> 6   com.apple.CoreText                0x95cbba47 
> TTypesetterRunArray::TTypesetterRunArray(__CFArray const*, __CFString const*, 
> void const* (*)(__CTRun const*, __CFString const*, void*), void*) + 209
> 7   com.apple.CoreText                0x95cbb962 
> CTTypesetterCreateWithRunArray + 90
> 8   com.apple.AppKit                  0x92dae76f -[NSATSGlyphStorage 
> createCTTypesetter] + 1585
> 9   com.apple.AppKit                  0x92daa8bc -[NSATSTypesetter 
> _ctTypesetter] + 323
> 10  com.apple.AppKit                  0x92da994b -[NSATSLineFragment 
> layoutForStartingGlyphAtIndex:characterIndex:minPosition:maxPosition:lineFragmentRect:]
>  + 72
> 11  com.apple.AppKit                  0x92da84a4 -[NSATSTypesetter 
> _layoutLineFragmentStartingWithGlyphAtIndex:characterIndex:atPoint:renderingContext:]
>  + 2760
> 12  com.apple.AppKit                  0x92e1addf -[NSATSTypesetter 
> layoutParagraphAtPoint:] + 155
> 13  com.apple.AppKit                  0x9331ecf0 -[NSTypesetter 
> _layoutGlyphsInLayoutManager:startingAtGlyphIndex:maxNumberOfLineFragments:maxCharacterIndex:nextGlyphIndex:nextCharacterIndex:]
>  + 2935
> 14  com.apple.AppKit                  0x92e19fbe -[NSTypesetter 
> layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments:] + 218
> 15  com.apple.AppKit                  0x92e19ea2 -[NSATSTypesetter 
> layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments:] + 1316
> 16  com.apple.AppKit                  0x92e17eb4 -[NSLayoutManager(NSPrivate) 
> _fillLayoutHoleForCharacterRange:desiredNumberOfLines:isSoft:] + 1020
> 17  com.apple.AppKit                  0x92e8a509 -[NSLayoutManager(NSPrivate) 
> _fillLayoutHoleAtIndex:desiredNumberOfLines:] + 261
> 18  com.apple.AppKit                  0x92e8cf9c +[NSLayoutManager(NSPrivate) 
> _doSomeBackgroundLayout] + 927
> 19  com.apple.AppKit                  0x92e51af4 _NSPostBackgroundLayout + 562
> 20  com.apple.CoreFoundation          0x95f8b892 __CFRunLoopDoObservers + 1186
> 21  com.apple.CoreFoundation          0x95f483e2 __CFRunLoopRun + 1154
> 22  com.apple.CoreFoundation          0x95f47864 CFRunLoopRunSpecific + 452
> 23  com.apple.CoreFoundation          0x95f47691 CFRunLoopRunInMode + 97
> 24  com.apple.HIToolbox               0x96589f0c RunCurrentEventLoopInMode + 
> 392
> 25  com.apple.HIToolbox               0x96589cc3 ReceiveNextEventCommon + 354
> 26  com.apple.HIToolbox               0x96589b48 
> BlockUntilNextEventMatchingListInMode + 81
> 27  com.apple.AppKit                  0x92ceeac5 _DPSNextEvent + 847
> 28  com.apple.AppKit                  0x92cee306 -[NSApplication 
> nextEventMatchingMask:untilDate:inMode:dequeue:] + 156
> 29  com.apple.AppKit                  0x92cb049f -[NSApplication run] + 821
> 30  com.apple.AppKit                  0x92ca8535 NSApplicationMain + 574
> 31  com.boo.myapp             0x00006bf1 main + 376 (main.m:32)
> 32  com.boo.myapp             0x00002a51 start + 53
> 
> Thread 1:  Dispatch queue: com.apple.libdispatch-manager
> 0   libSystem.B.dylib                 0x94a3a0ea kevent + 10
> 1   libSystem.B.dylib                 0x94a3a804 _dispatch_mgr_invoke + 215
> 2   libSystem.B.dylib                 0x94a39cc3 _dispatch_queue_invoke + 163
> 3   libSystem.B.dylib                 0x94a39a68 _dispatch_worker_thread2 + 
> 234
> 4   libSystem.B.dylib                 0x94a394f1 _pthread_wqthread + 390
> 5   libSystem.B.dylib                 0x94a39336 start_wqthread + 30
> 
> Thread 2:
> 0   libSystem.B.dylib                 0x94a32856 select$DARWIN_EXTSN + 10
> 1   com.apple.CoreFoundation          0x95f87ddd __CFSocketManager + 1085
> 2   libSystem.B.dylib                 0x94a40fbd _pthread_start + 345
> 3   libSystem.B.dylib                 0x94a40e42 thread_start + 34
> 
> Thread 3:
> 0   libSystem.B.dylib                 0x94a39182 __workq_kernreturn + 10
> 1   libSystem.B.dylib                 0x94a39718 _pthread_wqthread + 941
> 2   libSystem.B.dylib                 0x94a39336 start_wqthread + 30
> 
> Thread 4:  Dispatch queue: Garbage Collection Work Queue
> 0   libauto.dylib                     0x927fc707 
> Auto::MemoryScanner::scan_range(Auto::Range const&, Auto::WriteBarrier*) + 919
> 1   libauto.dylib                     0x927fcb24 
> Auto::MemoryScanner::scan_for_unmarked_blocks(Auto::Subzone*, unsigned long, 
> void*) + 148
> 2   libauto.dylib                     0x927fcd53 
> Auto::MemoryScanner::scan_pending_until_done() + 339
> 3   libauto.dylib                     0x927fced9 Auto::MemoryScanner::scan() 
> + 41
> 4   libauto.dylib                     0x927f2f98 Auto::Zone::collect(bool, 
> void*, unsigned long long*) + 152
> 5   libauto.dylib                     0x927dca37 
> auto_collect_internal(Auto::Zone*, int) + 407
> 6   libauto.dylib                     0x927dd36c 
> auto_collection_work(Auto::Zone*) + 140
> 7   libSystem.B.dylib                 0x94a47828 
> _dispatch_call_block_and_release + 16
> 8   libSystem.B.dylib                 0x94a3a1f4 _dispatch_queue_drain + 249
> 9   libSystem.B.dylib                 0x94a39c52 _dispatch_queue_invoke + 50
> 10  libSystem.B.dylib                 0x94a39a68 _dispatch_worker_thread2 + 
> 234
> 11  libSystem.B.dylib                 0x94a394f1 _pthread_wqthread + 390
> 12  libSystem.B.dylib                 0x94a39336 start_wqthread + 30
> 
> Thread 5:
> 0   libSystem.B.dylib                 0x94a39182 __workq_kernreturn + 10
> 1   libSystem.B.dylib                 0x94a39718 _pthread_wqthread + 941
> 2   libSystem.B.dylib                 0x94a39336 start_wqthread + 30
> 
> Thread 0 crashed with X86 Thread State (32-bit):
>  eax: 0x0000005f  ebx: 0x92eadcfe  ecx: 0x00000000  edx: 0x00000001
>  edi: 0x01422250  esi: 0x0021d400  ebp: 0xbfffcf18  esp: 0xbfffcef0
>   ss: 0x0000001f  efl: 0x00010246  eip: 0x92eadd3e   cs: 0x00000017
>   ds: 0x0000001f   es: 0x0000001f   fs: 0x00000000   gs: 0x00000037
>  cr2: 0x0000017c
> 
_______________________________________________

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