Debug in VS2022
-
Right so through trial and error I've narrowed my bug search to the script below, which is to do with Macros.
I've made a mini project with the same script and modules etc, plus some presets for browsing through (which is where the crash happens) but I can't replicate the issue in that project, only my main much larger project.
Does anyone have any ideas on how to progress? If I have either part of the script (so either declaring the front end macros, or the laf script - or both) my project crashes. I'm not sure the stack trace is helping, but I could be wrong!
/////////////// MACROS ////////////// Engine.setFrontendMacros(["LFO1", "LFO2", "STEP", "X", "Y"]); laf.registerFunction("drawNumberTag", function(g, obj) { var coloursmacros = [0xFF78016F, 0xFF006868, 0xAAFFCA00, 0xFF7B7B7B, 0xFF7B7B7B]; obj.area[0] += obj.area[2] - 15; obj.area[1] += 0; obj.area[2] = 14; obj.area[3] = 14; g.setColour(coloursmacros[obj.macroIndex]); g.fillRoundedRectangle(obj.area, 4); g.setColour(0x73D6D6D6); g.drawRoundedRectangle(obj.area, 4, 2); var letters = ["1", "2", "S", "X", "Y"]; g.setColour(0xFFE3E3E3); g.drawAlignedText(letters[obj.macroIndex], obj.area, "centred"); });
-
Duplicate your broken project and start removing stuff systematically until the problem goes away
-
@d-healey I’ve just done that. Which is how I ended up at this script. Unless you mean removing ui objects?
I went through each section one by one switching the ui objects save in preset function to off until nothing was save in preset and still I had the crash. I removed all scripts one by one until I hit this one.
-
@DanH If you comment out the laf function does it work?
-
@d-healey It only works if the whole script above is commented out. If either part is there then it crashes.
It should also be said that this was apparently working fine in the previous edition of the software, created on a commit from last April. The script is identical.
-
@DanH I have no idea then, I'm not familiar with the macro panel.
-
@d-healey ok thanks for the help anyways!
-
@DanH is that not weird to re-assign the area object?
-
@ustk I hadn't noticed that. I usually make a copy with
var a = obj.area
but sinceobj.area
is an arraya
is probably just a reference and it hasn't caused me any issues, so I think that it should be fine. -
@DanH hey there did you ever find any more information about this? im having the same issue in one of my projects and i think its related.
-
@Adam_G crikey, I can't remember. I think I was just trying to debug for the hell of it and found some things that were flagged up but ultimately it worked out fine...
-
@DanH you mentioned presets that had macro controls in them were causing access violations. did you resolve that?