From db8c14ba64099dbcb2bddefbb87c4ee7ba872ae5 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Sun, 28 Feb 2010 22:15:01 +0000 Subject: [PATCH] Remove SEGV workaround: this isn't the problem --- include/IWindow.hpp | 1 - src/Main.cpp | 25 +------------------------ src/SDLWindow.cpp | 10 +--------- 3 files changed, 2 insertions(+), 34 deletions(-) diff --git a/include/IWindow.hpp b/include/IWindow.hpp index 66ff14a..c50c383 100644 --- a/include/IWindow.hpp +++ b/include/IWindow.hpp @@ -29,7 +29,6 @@ public: virtual void run(IScreenPtr aScreen) = 0; virtual void switchScreen(IScreenPtr aScreen) = 0; virtual void quit() = 0; - virtual void forceQuit() = 0; virtual void takeScreenShot() = 0; virtual int width() const = 0; virtual int height() const = 0; diff --git a/src/Main.cpp b/src/Main.cpp index ed202be..ac8203b 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -33,12 +33,10 @@ using namespace boost::filesystem; namespace { IWindowPtr window; struct sigaction oldSIGINT; - struct sigaction oldSIGSEGV; void clearSignalHandlers() { sigaction(SIGINT, &oldSIGINT, NULL); - sigaction(SIGSEGV, &oldSIGSEGV, NULL); } void SIGINT_handler(int unused) @@ -48,24 +46,6 @@ namespace { clearSignalHandlers(); } - - void SIGSEGV_handler(int unused) - { - // Getting a SEGV on Linux when using OpenGL can cause some - // very nasty things to happen - particularly with the - // proprietry Nvidia drivers - - error() << "Caught SIGSEGV! Trying to clean up..."; - - // We could do a lot more here like printing a stack trace - - clearSignalHandlers(); - - ::window->forceQuit(); - - // Hopefully this will produce a useful core dump - abort(); - } void setupSignalHandlers() { @@ -75,9 +55,6 @@ namespace { sigemptyset(&sa.sa_mask); sigaction(SIGINT, &sa, &oldSIGINT); - - sa.sa_handler = SIGSEGV_handler; - sigaction(SIGSEGV, &sa, &oldSIGSEGV); } // Options set from command line @@ -152,7 +129,7 @@ int main(int argc, char** argv) IConfigPtr cfg = getConfig(); ::window = makeSDLWindow(); - + IScreenPtr screen; if (::action == "edit") { if (resourceExists(mapFile, "maps")) diff --git a/src/SDLWindow.cpp b/src/SDLWindow.cpp index ef0f368..866bc75 100644 --- a/src/SDLWindow.cpp +++ b/src/SDLWindow.cpp @@ -45,7 +45,6 @@ public: void run(IScreenPtr aScreen); void switchScreen(IScreenPtr aScreen); void quit(); - void forceQuit(); void takeScreenShot(); int width() const { return width_; } int height() const { return height_; } @@ -166,7 +165,7 @@ SDLWindow::SDLWindow() // Start OpenGL printGLVersion(); initGL(); - + log() << "Created " << width_ << "x" << height_ << " window"; } @@ -248,13 +247,6 @@ void SDLWindow::quit() amRunning = false; } -// Stop the game in an emergency -void SDLWindow::forceQuit() -{ - quit(); - SDL_Quit(); -} - // Convert an SDL button constant to a MouseButton MouseButton SDLWindow::fromSDLButton(Uint8 aSDLButton) const { -- 2.39.2