External display buffers visualization crash
-
Hi guys, I'm facing an issue when trying to display a buffer into a panel, using a timer.
I've created an issue on github but I'm wondering if someone has a clue on how to solve it.When debugging, the returned error is here :
hise::HiseJavascriptEngine::RootObject::ConstReference::isConstant() const at /Users/mathieurahm/GitHub/HISE/hi_scripting/scripting/engine/JavascriptEngineExpressions.cpp:88
bool isConstant() const override { jassert(ns != nullptr); // << ERROR auto v = ns->constObjects.getValueAt(index); // objects and arrays are not constant... return !v.isArray() && !v.isObject(); }
I can understand what that means but I've no idea about a solution.
Steps to reproduce :
You can load the snippet 'Scriptnode Visualization 101' from the snippets repo : It loads fine.
HiseSnippet 3018.3oc2ZzzaabbcojV4p0NAIEAA83.0BTp.ZZtLwoAIvvVeQagJISXJYmhf.gg6Njbh1cmMyLqjXBx0h9yn8ZO1C8OPO1KEn+C58B3K8b56Mytb2UhxVVwwnoDvlbm4Muu+bV0WJBXJkP5zXkCllxbZbK2ASSzS1bBkm3ryVNMda28nJMSRrKswzTpRwBcZzXwGhKzXkkbLed982fFQSBXkK437TAOfsKOlqKWs+C9s7nndzP1A73JP+QOXm.QxlhHQFvOK51wIkFbLcLaeJB1BtNMVd6PtVHGnoZlxowRaHBmNXh3zDK7Okq3CiX3C9NC.DYWtmHJD4XbUmMmviB6WH2JGmFt8K0BKZ0Bum6d7P9r0K0FuiYCR4IppOZrPc1awZrmeU1qSE1aNrTiJrzRVV5ccGDH4o5xcP94lt6j.FmQTPsWkUrv5rve6Vt24C9.h8wDQHi.LQFMhqnZtHg32w2yyamQjohLRBiERnjQYQQjtaQRiDZhXDQOgQT7wIznVjLEi73T6QaO6fhjnoEmVjvtcHXWST.PzHxIznLFfCpln.UgxftfLojkny2zq4HgjnzYiFQh3GyHwhvaK4IiUDpTjkfn83DwPB.0SOjDy.IVsVKxNjSEYQgDU13wLktfw51l34c.xzkRcBSepPdLYBSxHbE4qx.3oHgHAnwkbJWOAVPEINkrauGaYX.vQfP4wSzBXyTF8XhAcTCOMNRLjFcT.ELpl0a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cO3GecO3u45dvO4kePrHTdOKXnIzaT+ssMW1X6Dr0NSDgy+UeWzfl
Then hit "Compile" : it crashes HISE.
Cheers!
-
@Matt_SF This is probably because the data objet of P1 (buffer) and P2 (value) are not defined before the first timer call.
Panels are always painting a first time at compile, when these objects don't yet exit
THEN, the timer runs a first time creating those objects.Two solutions :
- Declare the object after the panels are referenced
const var P1 = Content.addPanel("P1", 0, 0); P1.data.buffer = Content.createPath(); const var P2 = Content.addPanel("P2", 110, 0); P2.data.value = 0;
- Or check if the data objects are defined for the paintRoutine before using them
// in P2 paint routine if (isDefined(this.data.buffer)) g.fillPath(this.data.buffer, this.getLocalBounds(0)); // in P2 paint routine if (isDefined(this.data.value)) g.setColour(Colours.withAlpha(Colours.white, this.data.value));
-
@ustk Thanks for your answer Greg! Unfortunately it still returns the same error...
Edit : If I 'Continue' debugging in VS, I end up here:
inline int size() const noexcept { return numUsed; } HISE Debug.exe!juce::ArrayBase<juce::NamedValueSet::NamedValue,juce::DummyCriticalSection>::size() Ligne 201 HISE\JUCE\modules\juce_core\containers\juce_ArrayBase.h(201)
-
@Matt_SF Well it's not crashing here.
Last develop commit? Mine's dating from 5 days ago...9580e1bc3ddd30f85e6dc77d5593e41ebee9d359
-
-
Nope, still no luck. I even checked the JUCE folder in the projucer...
The weird thing is that it works when I load the project but crashes as soon as I hit 'Compile' again...
(And now, the snippet browser is also crashing with the latest commit :face_with_tears_of_joy:
Something related to the new CSS additions) -
OK I built the latest Master branch but it still crashes...
@Christoph-Hart Maybe you'l have an idea about thisOddly it used to work before...
-
@Matt_SF Have you tried the commit I pointed?
Do you delete the binary folder before building? -
@ustk Yes and yes, but it still crashes... It must be something on my machine then but I don't know what could cause this. I haven't made any modifications in the source code...
I'll try to dig in... -
I even deleted my HISE folder and re-cloned it from Christoph's repo but it's still not working...
Oddly, if I increase the timer, it doesn't crash (above 300ms)... -
@Matt_SF Strange indeed... Have you tried a new minimal project from scratch? Maybe this one is corrupted somehow... Though I wouldn't understand why it doesn't crash above 300ms...
No error code in the console?
If you run a debug in your IDE, what does the crash report say? -
@ustk I recreated a minial project but the crash still happens.
I'm also puzzled by the timer thing...What the IDE outputs :
1 - actually I made a mistake in my OP, there's a debug breakpoint inHISE Debug.exe!hise::HiseJavascriptEngine::RootObject::ConstReference::isConstant() Ligne 88 HISE\hi_scripting\scripting\engine\JavascriptEngineExpressions.cpp(88)
bool isConstant() const override { jassert(ns != nullptr); auto v = ns->constObjects.getValueAt(index); // << BREAKPOINT // objects and arrays are not constant... return !v.isArray() && !v.isObject(); }
2 - 'Read access violation' in
HISE Debug.exe!juce::ArrayBase<juce::NamedValueSet::NamedValue,juce::DummyCriticalSection>::size() Ligne 201 HISE\JUCE\modules\juce_core\containers\juce_ArrayBase.h(201)
inline int size() const noexcept { return numUsed; }
-
@Matt_SF Strangely when opening your snippet, the global cable not is not there (probably something wrong in the xml)
Have you tried a very minimal snippet without a global cable? -
@ustk yes it isn't displayed in the snippet example (coming from the examples repo), but the cable method works fine.
I tried indeed without the cable.I'm actually working on a drums plugin, that's why it's more convenient to use the buffer solution because I can dynamically change the buffer source, which is not possible to do when using global cables.
-
@Matt_SF please try this snippet, I'd like to check if your huge buffer length can be problematic in the present case.
HiseSnippet 1571.3ocuX8taaaCDmJILs1McXEqO.B4SJ.dtVNooIaXXt4OtyXMoFwoACqnHiQh1lvRjZRzM1anC6i6wZOR6MX6HojkTRbah2V8GRL4c7te2w69cLoarviljHhQVUNcZDEYsFt2Ttb39CILNpyAHqUwRZhDs2zHRRB0GYYs7KTxrprBR+4u918HADtGMeKD5LAyi9RVHSlua2VeOKHnMwmdJKrf1a0pimfuuHPLFvwx3FnHh2Hx.5wDkZKgAPbnOSJh6II.XPVqrmveZughK4F8OikvtHfpV3h5AFxrcaQfuBwpcQ6OjE32MKdSPfU5lG8Kah9GiOh4ylsedV3y0BryOQw7g0Rkg2xkfmaQ30n.7tAHYU.RqXfziv87hYQxbIJ77.bGtjF2m.o8hPwnKZoeaY79BPCtrdHYDsc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u.RkgUFI6whl7DfoPM8k5ohKqjahdi2TlqJNT3ardIm+3BNelFKl6Vtf6VCKR7f25pnLPWKZio0KH9t4MU5OfNIil+J8RWcGXcGtOchhM3KgYGcIwvSpkFUWc1JvUGw3mop+guppGPGQlLa8Vv5dRZjpeSsFFtm9WFbjJjKcNTAitZtQ+BbSPp9Syc2oQyMa1rfKp.RgOkbyiAy4ZNQC2s1sgq61Pa1H5klzoQglM2c2Fa8zsa1bys14Y67zzmF2NlBuzh6MMCa5AmyKbcKEtqhc2dNw6ZZCaehp8.U53naapzctoxW.rLy2nq7wLpxH2C2cHI4Cbgbqrxp5YuWEJ4ui.gJTnWAmvFzD5bJWk+Y3P320yjcmJwWpTQp0cOIX15JIg4f+UwQTxnxf+AlVTsf6DxWYQaN0yMJF1kwa9aLNkDCuHWqv7zVObVsBd5wRlp1NImojBOiOKq.r0+qMvh7VyOIiBCIdwhy8LS2UAz806.oYt9+mPE7Qp01tn2kR+L6EZgvei+4ddkM00NXyE8fatnGbqE8fOcQO31K5Ae1hdvc93GT8uf44ikhPyCTfNitGpKBsrNjSfGioehI5e.jgizrK
-
@ustk Thanks. Same thing : it loads fine, and the buffer is displayed, but when I hit 'Compile' - without changing anything in the script - it crashes HISE.
-
Bibidi babidi bump !
@Christoph-Hart could you take a look at this if you have a moment please?
Just tell me if there is indeed something to be fixed, or if I need another tee-shirt -
Ok, if someone hits the same issue, I might have found a solution for this. I don't know if that's the proper way of handling it, but it seems to be working ok.
I chaned this bit, and replaced the assertion:
bool isConstant() const override { jassert(ns != nullptr); auto v = ns->constObjects.getValueAt(index); // objects and arrays are not constant... return !v.isArray() && !v.isObject(); }
by this :
bool isConstant() const override { if (ns == nullptr) return false; auto v = ns->constObjects.getValueAt(index); // objects and arrays are not constant... return !v.isArray() && !v.isObject(); }