Game rendering freezes (version 5.0.120)

The problem manifests itself in both version 5.0-beta119 and 5.0.120.
With certain sequences of actions, the rendering of the game is frozen (rotation occurs in a frame), while event processing occurs (data is stored, buttons are processed, the object “rotates”), but the picture simply freezes. The video shows how when the “R” button is pressed, the animations of the object (there are 3 of them) should be switched, the current animation number and the sequence of switching are indicated, after each press:

Project link:

The object has 3 animations with the following collision masks:

For objects 1 and 3, this is a rectangle by default, and for a triangle it is 3 vertices.
image image image

The code is simple:

With this setting, a problem arises: when switching to a triangle, everything is fine, when switching to a figure with a standard collision mask, drawing freezes until you return to the triangle again.
The sequence causing the problem is:

  1. switch to animation with 3 vertices in the collision mask;
  2. switch to animation with a collision mask, which is set by default (without using “Use a custom collision mask”).
    In this case, the picture freezes and recovers when switching to animation from “Use a custom collision mask”.

Several solutions to this problem:

  • if you add 4 vertices to the triangle, everything works;
  • if the animation following the triangle has “Use a custom collision mask”;
  • do not use the default collision mask if there is an animation with 3 vertices in the collision mask of another animation.