Defold: Custom easing curve crashes game

Created on 27 Nov 2020  路  3Comments  路  Source: defold/defold

Describe the bug (REQUIRED)
A game sometimes crashes if I use a custom easing curve.

To Reproduce (REQUIRED)
It's hard to reproduce. I suppose that it crashes when Lua GC is happened before an animation will be completed. The code is:

        gui.animate(node, "scale.y", second_scale.y , gui.EASING_OUTSINE, duration / 2, 0, function()
            local values_x = { 0, 0.1, 0.2, 0.4, 0.6 }
            local k = lume.randomchoice({-1, 1})
            for key, value in pairs(values_x) do
                values_x[key] = value * k 
                k = -1 * k
            end
            local my_easing_x = vmath.vector(values_x)
            local values_y = { 0, 0.1, 0.1, 0.1, 0.1 }
            k = -1 * k
            for key, value in pairs(values_y) do
                values_y[key] = value * k 
                k = -1 * k
            end
            local my_easing_y = vmath.vector(values_y)
            local storm_x = 100
            local storm_y = 50
            -- THE CAUSE OF CRASH:
            gui.animate(node, "position.x", storm_x, my_easing_x, duration / 3, 0, nil, gui.PLAYBACK_ONCE_PINGPONG)
            gui.animate(node, "position.y", storm_y, my_easing_y, duration / 3, 0, nil, gui.PLAYBACK_ONCE_PINGPONG)
            -- ^^^^^^^^^^^^^^^^^^^
        end)

Defold version (REQUIRED):

  • Version 1.2.176

Platforms (REQUIRED):

  • Platforms: Windows 10.

_It doesn't crash on HTML5!_

Screenshots:

Look at the screenshot from Visual Studio 2019 debugger:
image

As you can see, the vector points to a non-existent area.

bug engine

All 3 comments

Excellent bug report. Thanks!

It's hard to reproduce. I suppose that it crashes when Lua GC is happened before an animation will be completed.

Yes, this is very likely the correct assumption. Putting a call to collectgarbage() in update() will crash it immediately and every time.

ERROR:CRASH: CALL STACK:

# 0 pc   0x137f55fd MetadataUtilities _sigtramp+29
# 1 pc     0x1c4a24 dmengine _ZN8dmEasing8GetValueENS_5CurveEf+164
# 2 pc     0x28833d dmengine _ZN5dmGui16UpdateAnimationsEPNS_5SceneEf+557
# 3 pc     0x28a05e dmengine _ZN5dmGui11UpdateSceneEPNS_5SceneEf+1582
# 4 pc      0x4d3d5 dmengine _ZN12dmGameSystem13CompGuiUpdateERKN12dmGameObject22ComponentsUpdateParamsERNS0_22ComponentsUpdateResultE+245
# 5 pc      0x21368 dmengine _ZN12dmGameObject6UpdateEPNS_16CollectionHandleEPKNS_13UpdateContextE+584
# 6 pc       0x7617 dmengine _ZN8dmEngine4StepEPNS_6EngineE+919
# 7 pc       0x853a dmengine _Z14dmEngineUpdatePN8dmEngine6EngineE+26
# 8 pc       0x870d dmengine _ZN8dmEngine7RunLoopEPKNS_13RunLoopParamsE+109
# 9 pc       0x8672 dmengine _Z11engine_mainiPPc+98
Was this page helpful?
0 / 5 - 0 ratings