[futurebasic] FBToC/FB5 Crash with Colorwell and _kControlContentPictHandle

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : July 2009 : Group Archive : Group : All Groups

From: Robert Covington <artlythere@...>
Date: Thu, 9 Jul 2009 21:35:18 -0400
When I use this statement, with the modifier,  
_kControlContentPictHandle in FB5, it crashes.

appearance button _viewTextColorWell,¬
                   _activeBtn,¬
                   ,_kControlContentPictHandle,,¬
                   , @gTextForeColorRect,¬
                   _kControlImageWellProc


Works fine in FB4.

This does not crash...but something is going wonky somewhere.

appearance button _viewTextColorWell,¬
                   _activeBtn,¬
                   ,,,¬
                   , @gTextForeColorRect,¬
                   _kControlImageWellProc

If I install it without that constant, seems to work, the pict will  
install fine after with

Local Fn SetWellContents(pictH as handle,id as long )
dim wellInfo as ControlButtonContentInfo
'~';
wellInfo.contentType = _kControlContentPictHandle
#if def _FBToC
wellInfo.u.picture     = pictH
#else
wellInfo.picture     = pictH
#endif
def setButtondata( id,  
_kControlImageWellPart,_kControlImageWellContentTag, sizeof 
(wellInfo),@wellInfo)
end fn

I am however getting some bad memory corruption somewhere along the  
line that did not occur in FB4.

A global rect, set in the window build function before this is  
called,  and printing out as ok (Stop STR$(gToolColorRect.right)  
shows correct...

However, with nothing else touching that variable after, by the time  
it gets to the color well statement where it is used to create it, it  
is showing as Zero.

Then my document window after, becomes all wonky, and other rects are  
somehow overly large (the toolbar is corrupted). Some rect records  
are getting corrupted. :(

?  Why no crash in FB4, but a crash in FB5?

// Crashes in FB5 here , OS X 10.4.11
Local Fn Testwell
dim r as rect

setRect(r, 40,40, 120,160)
appearance button 1,¬
                   _activeBtn,¬
                   ,_kControlContentPictHandle,,¬
                   , @r,¬
                   _kControlImageWellProc

End Fn

Window 1

Fn Testwell


do
HandleEvents
until gFBQuit

Thread 0 Crashed:
0   ...ple.CoreServices.CarbonCore 	0x90bea494 LoadResourceCommon + 172
1   com.apple.HIToolbox            	0x9347029c  
HIImageWell::LoadContentIfNecessary() + 356
2   com.apple.HIToolbox            	0x9346f7d8 HIImageWell::DrawSelf 
(short, __HIShape const*, CGContext*) + 48
3   com.apple.HIToolbox            	0x932e36dc HIView::DrawCacheOrSelf 
(short, __HIShape const*, CGContext*) + 328
4   com.apple.HIToolbox            	0x932e3438 HIView::SendDraw 
(short, OpaqueGrafPtr*, __HIShape const*, CGContext*) + 100
5   com.apple.HIToolbox            	0x93391fd0  
HIView::RecursiveDrawNonComposited(short, OpaqueGrafPtr*,  
OpaqueRgnHandle*, unsigned char, unsigned char, unsigned char) + 468
6   com.apple.HIToolbox            	0x933916f0  
HIView::DrawNonComposited(short, OpaqueGrafPtr*, OpaqueRgnHandle*,  
unsigned long) + 312
7   com.apple.HIToolbox            	0x932fcf00 ActivateControl + 48
8   Test4                          	0x0001693c FBAppearanceButton +  
5864 (AppThings.c:2569)
9   Test4                          	0x0002588c Testwell + 88  
(_1_Test4,Temp_Project,Temp_Project.c:15)
10  Test4                          	0x000258dc main + 52  
(_1_Test4,Temp_Project,Temp_Project.c:30)
11  Test4                          	0x00002914 _start + 340 (crt.c:272)
12  Test4                          	0x000027bc start + 60

Thread 0 crashed with PPC Thread State 64:
   srr0: 0x0000000090bea494 srr1:  
0x000000000200f030                        vrsave: 0x0000000000000000
     cr: 0x88002448          xer: 0x0000000000000000   lr:  
0x0000000090bea434  ctr: 0x0000000090bea3e0
     r0: 0x0000000090bea434   r1: 0x00000000bffff630   r2:  
0x000000000180c800   r3: 0x00000000ffffff40
     r4: 0x00000000bffff670   r5: 0x00000000bffff608   r6:  
0x00000000001d5108   r7: 0x0000000000000011
     r8: 0x0000000000000012   r9: 0x0000000000000003  r10:  
0x0000000000000002  r11: 0x000000000180c8ae
    r12: 0x0000000090bea3e0  r13: 0x0000000000000000  r14:  
0x0000000000000000  r15: 0x0000000000000000
    r16: 0x0000000000000000  r17: 0x0000000000000000  r18:  
0x0000000000000000  r19: 0x0000000000000000
    r20: 0x0000000000000000  r21: 0x0000000000000000  r22:  
0x0000000000000001  r23: 0x0000000000000001
    r24: 0x00000000001d52b8  r25: 0x0000000000416660  r26:  
0x0000000000000000  r27: 0x0000000000000000
    r28: 0x0000000000427280  r29: 0x0000000000000001  r30:  
0x00000000ffffff40  r31: 0x0000000090bea3f8