Skip to content
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

The game client freezes and crashed when "Quit" button is pressed on NixOS #264

Open
cloudyluna opened this issue Jan 22, 2025 · 0 comments

Comments

@cloudyluna
Copy link

Clicking the main menu's quit button on NixOS freezes the game for 10 to 20 seconds and eventually exits with Segmentation fault (core dumped) on the console.

Later on, I tried reproducing this in lldb debugger, and the game raised this info on exit:

* thread #1, name = 'OneLife', stop reason = signal SIGSEGV: address not mapped to object (fault address: 0x0)
    frame #0: 0x0000555555740c6d OneLife`freeSprite(inSprite=0x0000000000000000) at gameGraphicsGL.cpp:660:35

A workaround that I came up with (I had to compile the game from the source) is to let freeSprite do its thing only if the passed argument is not a null pointer.

In minorGems:

diff --git a/game/platforms/openGL/gameGraphicsGL.cpp b/game/platforms/openGL/gameGraphicsGL.cpp
index 83e9659..ac411ee 100644
--- a/game/platforms/openGL/gameGraphicsGL.cpp
+++ b/game/platforms/openGL/gameGraphicsGL.cpp
@@ -657,8 +657,10 @@ SpriteHandle fillSpriteAlphaOnly( unsigned char *inA,
 
 void freeSprite( SpriteHandle inSprite ) {
     SpriteGL *s = (SpriteGL *)inSprite;
-    totalLoadedTextureBytes -= s->mWidth * s->mHeight * 4;
-    delete ( s );
+    if (s != nullptr) {
+      totalLoadedTextureBytes -= s->mWidth * s->mHeight * 4;
+      delete ( s );
+      }
     }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant