[Tl;DR] at end

This command is your friend - and - your foe!  :)

Yesterday I spent a significant amount of time trying to track down a 
compiled/built app crash, but did/does not happen interpretedly.

The crash happened only occasionally, after placing alerts and asserts, 
I determined that the crash was happening in a utility method which was 
doing a query. A method which, in the running code, had already been 
called repeatedly - without - issue.
Since the method which was doing the query had been called repeatedly 
-before- the crash, I was perplexed as to what the issue was.
After some more poking and prodding, it appeared that the crashing only 
occurred in the utility method, after a specific method (X) was called. 
Looking at X and watching it execute (interpretedly) provided no 
obvious clue as what the cause was. 
After staring at the code, and running both interpretedly and built 
many more times it finally dawned on me what the issue was...
Set Query Destination

In method X I was doing some work looking for duplicate data, and in so 
doing I was loping over a code that looked like this:
Set Query Destination(Into variable;$Local)
 <code>
Set Query destination(Into current selection)
 <code>
Set Query Destination(Into variable;$Local)

You might see the issue now... 
It turns out I never returned the query destination back to Current 
Selection.
To make the problem even more challenging, the utility method where the 
query was crashing was in a component.

Interpretedly, 4D was happy to create and type the local any time a 
query was executed after query destination was left into a local 
variable.... but... Needless to say compiled/built 4D DID NOT LIKE 
THAT!  :)

[TL;DR] 
-- always -- reset your query destinations  :)
Chip            
---------------
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing 
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to