[futurebasic] Re: [FB] FB4.4 AE problem

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 2011 : Group Archive : Group : All Groups

From: Brian S <fblistserve@...>
Date: Fri, 10 Jun 2011 10:54:55 -0700
On Jun 10, 2011, at 9:38 AM, Steve wrote:

> I have an old FB 4 project that uses SendAppleEvent.  It cannot be updated to FB5 and it needs to support AE sending and receiving.
So the project is old but presumably SendAppleEvent was recently added and doesn’t work?

> this simple example below will crash after iterating 62 times in FB4 and works without issues in FB5
> <snip>

> Looking at the RUNTIME definitions you can see only slight differences
Just to make sure we’re looking at the same thing, you’re comparing FBSendAppleEvent in Subs AppleEvents.incl for FB4 with FBSendAppleEvent in Subs Appearance AEvents.incl for FB5?

The substance is the same but the code is a little different at least in those two functions. However, there is a possibility the problem is not in that function or not only in that function.

Stack handling for the strings is different in FB5 than FB4. FB5 manages it with gFBStk stack pointer variable but FB4 handles in Subs Compiler.incl. The typical problem ( which has accounted for many past bugs in FB5 ) is the balance of the stack push/pops is not maintained thus more strings added eventually blows through the stack size. For FB4’s Subs Compiler.incl I can see:

_FBStrStkSize = 16384// 64 pascal Levels

Note the comment about 64 levels. This probably means the stack will blow out when the 64th string is added without appropriate pop management. Possibly, you could bump the stack size but this is not a real fix and the stack will blow out later. Anyway, Subs Compiler.incl looks like the likely place to look for a fix. Don’t know PowerPC assembler or I’d investigate in detail. 

Brian S