[futurebasic] Re: [FB] Updated : Crash when finding position in handle FB4.4.3 PPC

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

From: PZ <pierrezippi@...>
Date: Thu, 24 Sep 2009 07:21:05 -0500
I'm over the hump - i.e. I got it working with your help. Thanks! After
making the suggested changes the last bit was making the edit field ID
negative.

For the sake of closure:
That was the complete crash report.
OS 10.4.11 FB4.4.3 PPC

BEST ADVICE: "Don't assume it [where it crashes] is the same as before
Robert's suggestions.

StdEntry + 36  This does not exist as a function or word in my code.
TEStyleInsert + 48  Neither does this. Must be behind the code calls.
ClipSearBuild + 2196 This is the FN where the crash happened.

Thanks for the BREAK POINT advice. I have used the debugger several times
before, but it is painfully slow without setting breaks  - I never used
breaks before.

Thanks again. I could not move these programs from FB2 to FB4 without the
help of this list.


> From: Brian Stevens <bstevens33@...>
> Reply-To: <futurebasic@...>
> Date: Wed, 23 Sep 2009 15:51:40 -0700
> To: <futurebasic@...>
> Subject: Re: [FB] Updated : Crash when finding position in handle FB4.4.3 PPC
> 
> 
> (1) is there any more of the crash report than just this tidbit?
> Which OS X release just for grins?
> (2) do you know which statement crashes?  Don't assume it is the same
> as before Robert's suggestions.
> 
> ClipSearBuild is where it starts and crashes in StdEntry at offset 36
> ( hex ). Presumably StdEntry calls the posted code?
> 
> The type of crash typically indicates access to or changing of a piece
> of memory the code is protected from accessing ( such as a bad peek or
> poke but other statements can also access memory ). Using a null
> handle ( as suggested by Robert's and Michele's ) will also cause a
> crash.
> 
> The best place to start is to find the source statement that causes
> the crash. If the StdEntry name doesn't help, I would run the program
> through the FB4 debugger. Put a break point just before calling the
> offending function, run to the breakpoint ( via "go" option ) and then
> step through slowly until the line that crashes is found. Then go back
> and do it again and look at the data associated with the crashing
> statement. Data can be viewed in the debugger or you could use PRINT
> statements
> 
> Brian S.
> 
> 
> 
> On Sep 23, 2009, at 2:37 PM, PZ wrote:
> 
>> Here's the crash report. Something to do with the edit field?
>> 
>> 
>> EXC_BAD_ACCESS (0x0001)
>> KERN_PROTECTION_FAILURE (0x0002) at 0x00000000
>> 
>> Thread 0 Crashed:
>> 0    StdEntry + 36
>> 1    TEStyleInsert + 48
>> 2    ClipSearBuild + 2196
>> 
>> 
>> 
>> 
>>> From: PZ <pierrezippi@...>
>>> Reply-To: <futurebasic@...>
>>> Date: Wed, 23 Sep 2009 16:26:29 -0500
>>> To: <futurebasic@...>
>>> Conversation: [FB] Updated : Crash when finding position in handle
>>> FB4.4.3 PPC
>>> Subject: Re: [FB] Updated : Crash when finding position in handle
>>> FB4.4.3 PPC
>>> 
>>> Here's my corrected code (that still crashes when there is text on
>>> the
>>> clipboard. Text is a short list.
>>> 
>>> EF& = WINDOW(_efHandle)'edit field handle if it exists
>>> ListHndl&=fn GetClipBoard (_"TEXT")' as Handle'FN getClipText
>>> long if ( ListHndl& ) // GetClipBoard worked
>>> hndlSize&=FN GETHANDLESIZE(ListHndl&)
>>> long if ( hndlSize& ) // there's some text
>>> startChar&=0'[ListHndl&]
>>> FOR tpos&=0 to hndlSize& - 1'1 TO hndlSize&
>>> temp& = [ ListHndl& ] + tpos&
>>> value% = PEEK byte (temp&)
>>> LONG IF value%=13'entry must end with a CR to show
>>> numChars&=tpos&-startChar&
>>> tempStr$=FN lsMid$(ListHndl&,startChar&,numChars&)
>>> tempStr$ = tempStr$ +  CHR$(13)'ADD RETURN
>>> IF LEN(tempStr$)>0 THEN TEINSERT(@tempStr$+1,LEN(tempStr$),EF&)'
>>> display
>>> eventname
>>> startChar&=tpos&+1
>>> END IF
>>> NEXT tpos&
>>> end if
>>> end if
>>> EDIT FIELD #_ClipSearEdit1
>>> edtLen&=WINDOW(_efTextLen)'find end of text
>>> SETSELECT edtLen&, edtLen&'put cursor at end
>>> 
>>> 
>>>> From: Robert Purves <listrp@...>
>>>> Reply-To: <futurebasic@...>
>>>> Date: Thu, 24 Sep 2009 09:06:39 +1200
>>>> To: <futurebasic@...>
>>>> Subject: Re: [FB] Updated : Crash when finding position in handle
>>>> FB4.4.3 PPC
>>>> 
>>>> 
>>>> PZ wrote:
>>>> 
>>>>> I am getting a crash with no error message from when looking for
>>>>> positions
>>>>> in a handle of clipboard text. Anything obvious to the better
>>>>> educated?
>>>>> 
>>>>> ListHndl& = FN GetClipBoard (_"TEXT")
>>>> 
>>>> long if ( ListHndl& ) // GetClipBoard worked
>>>> 
>>>>> hndlSize&=FN GETHANDLESIZE(ListHndl&)
>>>> 
>>>> long if ( hndlSize& ) // there's some text
>>>> 
>>>>> startChar&=0
>>>> 
>>>> //FOR tpos&=1 TO hndlSize&
>>>> for tpos& = 0 to hndlSize& - 1 // characters are at offsets 0 to
>>>> hndlSize& - 1
>>>> 
>>>>> temp&= [ListHndl&] + tpos&   '**CRASHES here**
>>>>> value% = PEEK (temp&)
>>>>> LONG IF value%=13      'entry must end with a CR to show
>>>>>  numChars&=tpos&-startChar&
>>>>>  tempStr$=FN lsMid$(ListHndl&,startChar&,numChars&)
>>>>>  tempStr$ = tempStr$ +  CHR$(13)  'ADD RETURN for list in ef
>>>>>  IF LEN(tempStr$)>0 THEN CALL TEINSERT(@tempStr$+1,LEN(tempStr
>>>>> $),EF&)
>>>>>  startChar&=tpos&+1
>>>>> END IF
>>>>> NEXT tpos&
>>>> 
>>>> end if
>>>> end if
>>>> 
>>>>> EDIT FIELD #_ClipSearEdit1
>>>>> edtLen&=WINDOW(_efTextLen)          'find end of text
>>>>> SETSELECT edtLen&, edtLen&          'put cursor at end
>>>> 
>>>> Robert P.
>>>> 
>>>> --
>>>> To unsubscribe, send ANY message to: futurebasic-unsubscribe@...
>>>> 
>>> 
>>> --
>>> To unsubscribe, send ANY message to: futurebasic-unsubscribe@...
>>> 
>> 
>> --
>> To unsubscribe, send ANY message to: futurebasic-unsubscribe@...
>> 
> 
> Brian
> 
> --
> To unsubscribe, send ANY message to: futurebasic-unsubscribe@...
>