[JW Lua] FCStemMod can crash Finale

Jan Angermüller jan at angermueller.com
Wed Dec 30 12:04:17 CET 2015


Jari,

Finale crashes when a note entry gets an FCStemMod assigned without 
checking if FCNoteEntry.StemDetailFlag was already set.
Or in other words: it crashes when a note entry gets multiple FCStemMods.

Run the code snippet below to show the crash (tested on Finale 
2014d/Win10). Use a document without stem mods. It will crash on the 
second run ("goto redo"). To prevent crashing uncomment the 
e.StemDetailFlag condition.

Maybe you could add some code to prevent this crash if one should 
occasionally forget the StemDetailFlag test.

Jan


local region=finale.FCMusicRegion()
region:SetFullDocument()
local runtwice=true
::redo::
for e in eachentrysaved(region) do
     --if not e.StemDetailFlag then  --uncomment this line to prevent 
crashing
         local stemmod=finale.FCStemMod()
         stemmod:SetNoteEntry(e)
         stemmod:SetVerticalUpOffset(10)
         stemmod:SetVerticalDownOffset(-10)
         stemmod:UseBeamedData(false)
         stemmod:SaveNew()
     --end  --uncomment this line to prevent crashing
end
if runtwice then
    runtwice=false
    goto redo
end




More information about the JWLua mailing list