overte-org / overte

Overte open source virtual worlds platform.
https://overte.org/
Other
135 stars 50 forks source link

Assert on parenting material to a model #1097

Open ksuprynowicz opened 1 month ago

ksuprynowicz commented 1 month ago

To reproduce you first need to go to tutorial, create material like this:

Entities.addEntity({
    type: "Material",
    position: MyAvatar.position,
    materialURL: "materialData",
    priority: 1,
    materialData: JSON.stringify({
        materials: {
            model: "hifi_shader_simple",
            procedural: {
                version: 3,
                fragmentShaderURL: "https://gist.github.com/HifiExperiments/2f087e240ea340577de04bba662c4f47/raw/fd21fd15134da0eafc4304538d8a9db1463c5bf3/errorShader.fs",
            }
        }
    })
});

Then select the main model, and parent material to it. An assert will happen:

__pthread_kill_implementation 0x00007ffff08a6b0c
scriptable::make_scriptowned<…> GraphicsScriptingUtil.h:55
GraphicsScriptingInterface::getModel GraphicsScriptingInterface.cpp:136
ScriptMethodV8Proxy::call ScriptObjectV8Proxy.cpp:1146
ScriptMethodV8Proxy::callback ScriptObjectV8Proxy.cpp:998

Assert happens only in Debug build. In ReleaseWithDebInfo and Release it will probably cause memory corruption instead.

ksuprynowicz commented 1 month ago

It's due to instance->parent() being null.