A question about targets and threads

Matt Mower mmower at novissio.com
Wed Nov 26 16:35:21 PST 2003


Hi folks,

We are seeing a strange problem relating to the target & table verbs.

What we observe is multiple errors like:

Can't call table.getSortOrder() because the window does not contain a table.

One thing of note. These errors *never* occur when single-stepping 
through our code in debug mode.  They only ever occur when code is run.

We have a function setSortOrder( theTableAdr ) which looks like this:

---------------------------------------------------------
local {
   tOldTarget = target.set( theTableAdr )
};
if( string.lower( table.getSortOrder() ) != string.lower( theSortOrder ) ) {
   table.sortBy( theSortOrder )
};
target.set( tOldTarget );
return theTableAdr
---------------------------------------------------------

It's basically a wrapper around table.sortBy() that manages the target 
for you.  I include the function in case someone sees something 
boneheaded i've done.

To try and debug this I renamed the built in verb table.getSortOrder() 
to table.getSortOrder2 and added a new table.getSortOrder which 
validates the target check that it is (a) not nil, and (b) points a 
table object.

What I am seeing is that sometimes the target *IS* nil and sometimes it 
points at a visible object (e.g. an open script).

My understanding was that each thread had it's own independent value for 
the target so that this sort of thing should never happen.  But it 
definitely seems like the target is being altered at certain points.

Has anyone come across this sort of thing happening before?  Are there 
safe workarounds?

Regards,

Matt

[Fronter 9.0 / MacOS X 10.2]




More information about the Frontier-Users mailing list