ScriptUI oList.removeAll() tilts FM
Dear friends,
Back on stage I encounter a very strange problem. In the following short function I set up a DropDown list:
KLD_F.FillDlgList = function(oList, asListItems) { // ============
/* Fill dialogue list from global array
Arguments oList dialogue list to be filled from the array
asListItems array with the list items
Returns -
Called by various call-back functions
History 2020-11-10 tested with FMfindRepl
*/
var j, nItems;
nItems = asListItems.length;
oList.removeAll (); // clear the list
for (j = 0; j < nItems; j++) {
oList.add ("item", asListItems[j]);
}
} //--- end FillDlgList
It is encountered very often during executing the script FMfindRepl. Now I found that after certain sequences of operations, namely:
Find Cross-Reference (any) (2x)
Find Cross-Reference of Format ... (2x)
Find Cross-Reference (any) (2x)
Find Cross-Reference of Format ... → Zoingg
The script halts for a while in the line
oList.removeAll (); // clear the list
and then FM disappears silently (no dump, no trumpets...)

When stepping through the script (having set a counter of its calls to set the breakpoint) I see that, when entering this statement,
- First the display of data disappears in the debugger (same behaviour in ESTK CC)
- Then after about 5 seconds FM disappears.
In the past two months I had used this function during the tests close to 100 times and it behaved. It was quite tricky to find the reason for the instant disappearance of FM in recent tests.
Edit
After introducing a statement
Console ("oList length = " + oList.items.length);just before the removeAll line, I see this:
oList length = 0
oList length = 0
oList length = 0
oList length = 14Hence the removeAll fails if it should do what it is intended for...
I also need to check why in the other cases the list already emtpy.

