PositionGizmo dispose not complete

Hello,

I think that the dispose method of PositionGizmo is not complete.
It does not call the dispose method of the base class (gizmo.ts).
Therefore references to the Uititliy Layer (onBeforeRenderObservable) remain.
In my case, this leads to increased memory consumption and to the application crashing.

My workaround:

export class MyPositionGizmo extends PositionGizmo {
    /**
     * Disposes of the gizmo
     */
    public override dispose() {
        this._rootMesh.dispose();
        if (this._beforeRenderObserver) {
            this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.remove(this._beforeRenderObserver);
        }

        super.dispose();
    }
}

BR

cc @Cedric

I’ve added missing dispose in this PR:

1 Like