Question on runScene and the scene stack

Hello all,

I have a game whose main scene is running and when the player clicks the in-game menu a choice is available for returning to the main menu.
When this choice is touched/clicked the scene is pushed to the stack via pushScene.
The new scene that runs is a confirmation screen with yes and no options.
If the player chooses no i simply pop the scene and everything is fine.
If he choses yes i want to return to the main menu, which is NOT on the scenes’ stack.
Therefore i use runScene(new menuScene()).

The question is: the scene that was pushed in the stack but NEVER popped is destroyed, or am i leaking memory ?

I don’t use pushScene to present ingame menu, due to this very reason.

My understanding from the source code is that runScene or replaceScene will only deal with the scene on top of the scene stack. If you absolutely use pushScene, then you should use popToRootScene() before switching to the new Scene.

Edited: Sorry, I did not realize it is for JS. What I stated was for the C++, but the idea is the same. You need to ensure that you pop all the top scenes before transiting to the next Scene.