app crash on TextArea(?) resizing

Something is causing an app crash when I resize one of my containerControls, that contains other containerControls, TextAreas, scrollbars and canvases.

The crash report seems to point at a problem with TextArea - unless I am reading it wrongly. Can anyone point me to where I should be looking based on this crash report?

Jim

[quote]Process: Actio.debug [11215]
Path: /Users/USER/Documents/*/Actio.debug.app/Contents/MacOS/Actio.debug
Identifier: biz.ithought.actio
Version: 020239 (2.2.39.1.71)
Code Type: X86 (Native)
Parent Process: launchd [333]
Responsible: Actio.debug [11215]
User ID: 501

Date/Time: 2014-07-04 16:53:44.493 -0500
OS Version: Mac OS X 10.9.4 (13E28)
Report Version: 11
Anonymous UUID: 2190D630-B964-1881-B56B-F8F3D3679DD8

Sleep/Wake UUID: B76E4675-9D2D-43A3-A6F9-03B5BDBC43E7

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000000bf7ffffc

VM Regions Near 0xbf7ffffc:
Stack 00000000b0423000-00000000b04a4000 [ 516K] rw-/rwx SM=COW
–> Stack 00000000bc000000-00000000bf800000 [ 56.0M] —/rwx SM=NUL
Stack 00000000bf800000-00000000c0000000 [ 8192K] rw-/rwx SM=COW

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_malloc.dylib 0x95452fb2 szone_malloc_should_clear + 5
1 libsystem_malloc.dylib 0x95448b6a szone_malloc + 24
2 libsystem_malloc.dylib 0x9545555b malloc_zone_malloc + 75
3 com.apple.CoreFoundation 0x99e3e428 __CFAllocatorSystemAllocate + 24
4 com.apple.CoreFoundation 0x99e3e3f6 CFAllocatorAllocate + 198
5 com.apple.CoreFoundation 0x99e3e1f1 _CFRuntimeCreateInstance + 225
6 com.apple.CoreFoundation 0x99eb8463 CFRunLoopTimerCreate + 99
7 com.apple.Foundation 0x92a4fc9c -[NSCFTimer initWithFireDate:interval:target:selector:userInfo:repeats:] + 258
8 com.apple.Foundation 0x92a5009a +[NSTimer(NSTimer) timerWithTimeInterval:target:selector:userInfo:repeats:] + 142
9 com.apple.AppKit 0x96dc13d9 -[NSScrollerImpPair _rescheduleOverlayScrollerHideTimerWithDelay:] + 225
10 com.apple.AppKit 0x96c7472e -[NSScrollerImpPair _updateOverlayScrollersStateWithReason:forcingVisibilityForHorizontalKnob:verticalKnob:] + 4123
11 com.apple.AppKit 0x96dbf5f8 -[NSScrollerImpPair contentAreaScrolledInDirection:] + 160
12 com.apple.AppKit 0x96ac9ab3 -[NSClipView _immediateScrollToPoint:] + 689
13 com.apple.AppKit 0x96ac97c4 -[NSClipView scrollToPoint:] + 241
14 com.apple.AppKit 0x96c2a5c1 -[NSScrollView scrollClipView:toPoint:] + 176
15 com.apple.AppKit 0x96ace0a6 -[NSClipView _scrollTo:animateScroll:flashScrollerKnobs:] + 1540
16 com.apple.AppKit 0x96acd91e -[NSClipView _reflectDocumentViewFrameChange] + 119
17 com.apple.AppKit 0x96acd8a0 -[NSClipView _handleFrameChangeForSubview:] + 50
18 com.apple.AppKit 0x96a90cac -[NSView _postFrameChangeNotification] + 166
19 com.apple.AppKit 0x96a9a28e -[NSView setFrameSize:] + 1541
20 com.apple.AppKit 0x96c35a97 -[NSTextView(NSPrivate) _setFrameSize:forceScroll:] + 750
21 com.apple.AppKit 0x96c3579e -[NSTextView setFrameSize:] + 63
22 com.apple.AppKit 0x96b2efe4 -[NSTextContainer setContainerSize:] + 226
23 com.apple.AppKit 0x96b9c1cf -[NSTextContainer(NSPrivate) _resizeAccordingToTextView:] + 285
24 com.apple.AppKit 0x96c3b01e -[NSTextContainer(NSPrivate) _containerTextViewFrameChanged:] + 59
25 com.apple.Foundation 0x929fa732 __57-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke + 49
26 com.apple.CoreFoundation 0x99f695a4 CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER + 20
27 com.apple.CoreFoundation 0x99e4b04b _CFXNotificationPost + 3435
28 com.apple.Foundation 0x92a25a6f -[NSNotificationCenter postNotification:] + 115
29 com.apple.AppKit 0x96a90dce -[NSView _postFrameChangeNotification] + 456
30 com.apple.AppKit 0x96a9a28e -[NSView setFrameSize:] + 1541
31 com.apple.AppKit 0x96c35a97 -[NSTextView(NSPrivate) _setFrameSize:forceScroll:] + 750
32 com.apple.AppKit 0x96c3579e -[NSTextView setFrameSize:] + 63
33 com.apple.AppKit 0x96b2efe4 -[NSTextContainer setContainerSize:] + 226
34 com.apple.AppKit 0x96b9c1cf -[NSTextContainer(NSPrivate) _resizeAccordingToTextView:] + 285
35 com.apple.AppKit 0x96c3b01e -[NSTextContainer(NSPrivate) _containerTextViewFrameChanged:] + 59
36 com.apple.Foundation 0x929fa732 __57-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke + 49
37 com.apple.CoreFoundation 0x99f695a4 CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER + 20
[/quote]

This looks like the bug where resizing a TextArea smaller than 0 in width or height crashes, not right away but soon after. Retesting it seems to only crash for <0 height now. <https://xojo.com/issue/28667>

Workaround is to set Min Height so TextArea is never too small. Or if you can manually compute the size then you can use Resized to hide or set the TextArea so its never <0. You can’t use locks because those size the control before Resized, before you get a chance to hide it.

[code]Sub Resizing()

dim newheight As integer = self.Height - 200

if newheight <= 0 then
TextArea1.Visible = false
else
TextArea1.Visible = True
TextArea1.Height = newheight
end

End Sub[/code]

Will

It wasn’t the textArea crashing the app as far as I can tell. I ended up implementing your proposal not only on textAreas, but also on containerControls and scrollbars - decoupling all auto-resizing locks, and manually resizing contents. I’m not sure which of the objects was the culprit in the end, but it does seem to have fixed the problem.

Thanks for you help.

Jim