[futurebasic] Re: [FB] Slowdown in Leopard?

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2007 : Group Archive : Group : All Groups

From: Alain Pastor <apastor@...>
Date: Thu, 15 Nov 2007 01:17:59 +0100
Brian Stevens a écrit :
> 
> On Nov 14, 2007, at 2:25 PM, Lake Group wrote:
> 
>>  Should we be changing IsHandleValid everywhere?
> Not necessarily everywhere. Keep in mind we are bypassing an Apple bug. 
> Hopefully, at some point it will be fixed. The primary place to fix is 
> the runtime appearance include(as covered by Robert P earlier) because 
> that impacts every program compiled with the appearance runtime.
> 
> 
> 
> 
>> Using MyIsHandleValid in the situation below (from DataBrowser for 
>> Dummies) causes a crash.
> I'm sure Alain would agree that some of this code needs review 
> especially in light of OS X. For example, handle locks are not really 
> necessary in OS X.
> 
You're right Brian, I would agree but in this case I think there are a 
couple of issues: the code is intended to run also in MacOS 9 although I 
would gladly get rid of that compatibility, and actually the scenario I 
used is most certainly a bad one, because I wanted to allow the same 
function to receive whether a handle or the address of an array. I guess 
this is a no-no regarding the porting of this code in OS X precisely for 
FB2C compliance.

> Also, this code snippet begs more questions that could only be answered 
> by looking at the code that calls this fn.  Array is defined as a 
> pointer to long in the argument list. Presumably, the long is a handle 
> (if so, it should be defined as one). Dereferencing array (array.nil&) 
> and passing it to IsHandleValid looks suspect, but again without looking 
> at the calling code....
> 
The idea behind this clumsy coding is to determine if the function is 
dealing with a pointer or a handle according to the result of the 
Toolbox function isHandleValid. I have noticed too that this function 
could crash the app, perhaps I'm not using it as it is supposed to work. 
Secondly, I have noticed also that this function was slightly slowing 
down the execution of the code, so I'm not that much surprised to learn 
about the trouble it causes right now.


> 
>> Assuming there's pointer/handle situation here.  There are 9 or 10 
>> fn's in the DB for Dummies that pass  array.nil&. Perhaps there are 
>> others of this nature scattered about?
> Maybe. Again, this code needs a review not only for a substitute for 
> IsHandleValid, but also for other methods.
> 
> Your code might need to be adapted to use Robert's substitute for 
> IsHandleValid. For example, the pointer to a long type  in Fn 
> BrowserAddItems does not match the handle type defined in Robert's 
> function. The point is to bypass IsHandleValid for now. This effort will 
> probably require some thinking and study to get all code working.
> 
> 
I'm not sure it is possible to make the DBFD package work bypassing 
isHandleValid, alas.

Alain