-
-
Notifications
You must be signed in to change notification settings - Fork 471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Game crashes sporadically when selecting a different world #2920
Comments
This seems to be related to the amount of update steps that are done between drawing a frame. I played around with the |
Potentially having get_sector() return a pointer to a sector instead of a reference could fix this issue but then we'd have to add null checks to every function calling that. Does anyone have a better idea? |
I think we should just make sure a sector is always available, since initialization. It's not supposed to not have a current sector set. |
Maybe I found a solution. The worldmap camera is a member of WorldMapSector, so it belongs to a specific worldmap sector. When But in general I agree to @Vankata453 , that having always a valid current sector would be preferrable. |
@Brockengespenst Thanks for checking this out! Would you like to create a PR for this? |
Sure, no problem. Please check #2921. |
Fixes nullptr dereferencing when a new WorldMap has been allocated, but no sector has been setup yet Fixes #2920
SuperTux version:
Development state b778105
System information:
macOs Ventura 13.6.6
Expected behavior
No crash when selecting another world
Actual behavior
Game crashes sporadically with segfault
Steps to reproduce actual behavior
Additional debugging information
Stacktrace:
The stacktrace is a bit misleading, the problem seems to be that in
WorldMapSector& get_sector() const { return *m_sector; }
m_sector is nullptr. My assumption is, that on world change a new WorldMap is allocated which leads to an updated worldmap currenton.WorldMapSector::current()->get_sector()
refers to the new WorldMap currenton which has no sector yet setup viaset_sector
and thusWorldMap::get_sector()
tries to dereference a nullptr.The text was updated successfully, but these errors were encountered: