Loading savefiles programatically issue

Hello there!
I will write my question here, since it’s not an issue directly speaking, and it will be a quite large to post on the chat.

We wanted to implement a custom savefile load procedure (load a savefile from map) using the provided DynRPG interface in Player. We managed to implement a load procedure using Player::LoadSavegame (https://github.com/EasyRPG/Player/blob/a88fce708a1e1036edd05d15fd18735df50f2148/src/player.cpp#L973).

//called this from a map, specifically from a DynRPG comment. 

int saveSlot = 1;
std::string save_name = FileFinder::FindDefault(*tree, fmt::format("Save{:02d}.lsd", saveSlot));
Player::LoadSavegame(save_name, saveSlot);

Until then, everything seems to work “okay™” (despiste some transition issues than were solved by previous screen clear commands). However, people reported several issues at loading savefiles:

There’s a project (I’m attaching it: https://elsemieni.net/inni/EA.zip ) that have a strange issue:

In certain savefile, if you load in the normal way (via load menu, or via --load-game-id) everything works fine. However, if I use the mentioned custom load mechanism, Player crashes when tries to process map events after loading the savefile:

Seems it’s trying to process events with invalid pointers.

An interesting fact, If I load this savefile with the custom method AFTER previously loading the target map before, this bug will not happen and everything loads fine (also if I normally load the savefile without the map previously loaded works too). And also, it is just this particular case (I’m trying to isolate the case without much luck). So, I’m guessing I miss something in the custom savefile load procedure (perhaps some cleaning, or some scene push/pop, etc).

Do you guys have any idea what can be happening?
Anyways, I acknowledge that I’m messing with customizing player (and it’s consequences), but as people said, I don’t lose anything asking. Of course I will still trying to research the causes and/or solutions or workarounds about.