Enigma-Game / Enigma

Enigma is a puzzle game inspired by Oxyd on the Atari ST and Rock'n'Roll on the Amiga. The object of the game is to find uncover pairs of identically colored Oxyd stones. Simple? Yes. Easy? Certainly not! Hidden traps, vast mazes, laser beams, and, most of all, countless hairy puzzles usually block your direct way to the Oxyd stones …
GNU General Public License v2.0
134 stars 38 forks source link

Unclean Level Shutdown #78

Open alochmann opened 2 years ago

alochmann commented 2 years ago

When a level is deleted from memory (e.g. when the level ends or the app is shut down), level.reset() is called. This first sets the pointer "level" is pointing to to null, then deletes the world. However, we sometimes have to call DisposeObject during world deletion, which in turn refers to "level"; which has just been set to null. To avoid segfaults, we provide level with a new world instead. This method might have unexpected side effects: E.g. when unnaming an object during its deletion, it will search its name in the new world's catalogue instead of the old world's.

As of 2022, there are no known symptoms. Cleaning the code involves reworking all destructors. So we defer the repairs.