[futurebasic] Re: [FB] String corruption [fixed, wooohooo :) ]

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : February 2012 : Group Archive : Group : All Groups

From: Robert Covington <artlythere@...>
Date: Sun, 5 Feb 2012 01:01:10 -0500
On Feb 5, 2012, at 12:47 AM, Robert Purves wrote:

> 
> On 5/02/2012, at 5:30 PM, Robert Covington wrote:
> 
>> I have confirmed this.
>> 
>> If I alter FBAppearanceWindow to set the title right after window creation, but before the official default FB handlers are installed, the name remains as it should.  
> 
> Good detective work.

Thanks. 

> 
>> Q to be answered: What could change the reference of titlePtr in FBAppearanceWindow between it's good form before window creation, and bad one, after, due to string stack work as a result of the handlers called in the interim before titlePtr is set just a few lines down the road, in AppThings.c?
> 
> Your DoDialog handler performs some string manipulation that overwrites the string stack entry used for the title.
> The reason is that FBAppearanceWindow() pops the stack too soon. 

Happens if you do a string comparison during the handler before the title is set back in FBAppearanceWindow.

dim as str255 tmp

tmp = Chr$(13) //  no change
tmp = "liter" // no change
if tmp = "liter" then... // changes the window pointer.

> I think this should fix it.
> 
> Comment out the line:
>    //if ( titlePtr ) gFBStk--;
> and instead insert:
>    Boolean  popStackOnExit = ( titlePtr != NULL );
> 
> 
> Insert a line after the label CantCreateWindow:
>    if ( popStackOnExit ) gFBStk--; 

(Big sigh of relief)

Yes, that changes it to normal results. I am back in action! Whooooohoo.

Gracias.  Coolsville. And even better, not too esoteric. (I'm not overwriting memory, here at least   :) 
  
Robert