Index: /code/branches/resource2/src/core/Core.cc
===================================================================
--- /code/branches/resource2/src/core/Core.cc	(revision 5657)
+++ /code/branches/resource2/src/core/Core.cc	(revision 5658)
@@ -303,6 +303,6 @@
     void Core::loadGraphics()
     {
-        if (bGraphicsLoaded_)
-            return;
+        // Any exception should trigger this, even in upgradeToGraphics (see its remarks)
+        Loki::ScopeGuard unloader = Loki::MakeObjGuard(*this, &Core::unloadGraphics);
 
         // Upgrade OGRE to receive a render window
@@ -314,11 +314,10 @@
 
         // Calls the InputManager which sets up the input devices.
-        scoped_ptr<InputManager> inputManager(new InputManager(windowHnd));
+        inputManager_.reset(new InputManager(windowHnd));
 
         // load the CEGUI interface
         guiManager_.reset(new GUIManager(graphicsManager_->getRenderWindow()));
 
-        // Dismiss scoped pointer
-        inputManager_.swap(inputManager);
+        unloader.Dismiss();
 
         bGraphicsLoaded_ = true;
@@ -327,7 +326,4 @@
     void Core::unloadGraphics()
     {
-        if (!bGraphicsLoaded_)
-            return;
-
         this->guiManager_.reset();;
         this->inputManager_.reset();;
@@ -637,54 +633,24 @@
     }
 
-    bool Core::preUpdate(const Clock& time) throw()
-    {
-        std::string exceptionMessage;
-        try
-        {
-            if (this->bGraphicsLoaded_)
-            {
-                // process input events
-                this->inputManager_->update(time);
-                // process gui events
-                this->guiManager_->update(time);
-            }
-            // process thread commands
-            this->tclThreadManager_->update(time);
-        }
-        catch (const std::exception& ex)
-        { exceptionMessage = ex.what(); }
-        catch (...)
-        { exceptionMessage = "Unknown exception"; }
-        if (!exceptionMessage.empty())
-        {
-            COUT(0) << "An exception occurred in the Core preUpdate: " << exceptionMessage << std::endl;
-            COUT(0) << "This should really never happen! Closing the program." << std::endl;
-            return false;
-        }
-        return true;
-    }
-
-    bool Core::postUpdate(const Clock& time) throw()
-    {
-        std::string exceptionMessage;
-        try
-        {
-            if (this->bGraphicsLoaded_)
-            {
-                // Render (doesn't throw)
-                this->graphicsManager_->update(time);
-            }
-        }
-        catch (const std::exception& ex)
-        { exceptionMessage = ex.what(); }
-        catch (...)
-        { exceptionMessage = "Unknown exception"; }
-        if (!exceptionMessage.empty())
-        {
-            COUT(0) << "An exception occurred in the Core postUpdate: " << exceptionMessage << std::endl;
-            COUT(0) << "This should really never happen! Closing the program." << std::endl;
-            return false;
-        }
-        return true;
+    void Core::preUpdate(const Clock& time)
+    {
+        if (this->bGraphicsLoaded_)
+        {
+            // process input events
+            this->inputManager_->update(time);
+            // process gui events
+            this->guiManager_->update(time);
+        }
+        // process thread commands
+        this->tclThreadManager_->update(time);
+    }
+
+    void Core::postUpdate(const Clock& time)
+    {
+        if (this->bGraphicsLoaded_)
+        {
+            // Render (doesn't throw)
+            this->graphicsManager_->update(time);
+        }
     }
 }
Index: /code/branches/resource2/src/core/Core.h
===================================================================
--- /code/branches/resource2/src/core/Core.h	(revision 5657)
+++ /code/branches/resource2/src/core/Core.h	(revision 5658)
@@ -65,4 +65,5 @@
         typedef Loki::ScopeGuardImpl0<void (*)()> SimpleScopeGuard;
         friend class Singleton<Core>;
+        friend class Game;
 
         public:
@@ -78,10 +79,4 @@
 
             void setConfigValues();
-
-            bool preUpdate(const Clock& time) throw();
-            bool postUpdate(const Clock& time) throw();
-
-            void loadGraphics();
-            void unloadGraphics();
 
             static int   getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All);
@@ -117,4 +112,10 @@
             Core(const Core&); //!< Don't use (undefined symbol)
 
+            void preUpdate(const Clock& time);
+            void postUpdate(const Clock& time);
+
+            void loadGraphics();
+            void unloadGraphics();
+
             void checkDevBuild();
             void setExecutablePath();
Index: /code/branches/resource2/src/core/GUIManager.cc
===================================================================
--- /code/branches/resource2/src/core/GUIManager.cc	(revision 5657)
+++ /code/branches/resource2/src/core/GUIManager.cc	(revision 5658)
@@ -109,41 +109,29 @@
         COUT(3) << "Initialising CEGUI." << std::endl;
 
-        try
-        {
-            // Note: No SceneManager specified yet
-            guiRenderer_.reset(new OgreCEGUIRenderer(renderWindow_, Ogre::RENDER_QUEUE_OVERLAY, false, 3000));
-            resourceProvider_ = guiRenderer_->createResourceProvider();
-            resourceProvider_->setDefaultResourceGroup("GUI");
-
-            // setup scripting
-            scriptModule_.reset(new LuaScriptModule());
-            luaState_ = scriptModule_->getLuaState();
-
-            // Create our own logger to specify the filepath
-            std::auto_ptr<CEGUILogger> ceguiLogger(new CEGUILogger());
-            ceguiLogger->setLogFilename(Core::getLogPathString() + "cegui.log");
-            // set the log level according to ours (translate by subtracting 1)
-            ceguiLogger->setLoggingLevel(
-                static_cast<LoggingLevel>(Core::getSoftDebugLevel(OutputHandler::LD_Logfile) - 1));
-            this->ceguiLogger_ = ceguiLogger.release();
-
-            // create the CEGUI system singleton
-            guiSystem_.reset(new System(guiRenderer_.get(), resourceProvider_, 0, scriptModule_.get()));
-
-            // do this after 'new CEGUI::Sytem' because that creates the lua state in the first place
-            LuaState::openToluaInterfaces(this->luaState_);
-
-            // initialise the basic lua code
-            this->loadLuaCode();
-        }
-        catch (CEGUI::Exception& ex)
-        {
-#if CEGUI_VERSION_MAJOR == 0 && CEGUI_VERSION_MINOR < 6
-            throw GeneralException(ex.getMessage().c_str());
-#else
-            throw GeneralException(ex.getMessage().c_str(), ex.getLine(),
-                ex.getFileName().c_str(), ex.getName().c_str());
-#endif
-        }
+        // Note: No SceneManager specified yet
+        guiRenderer_.reset(new OgreCEGUIRenderer(renderWindow_, Ogre::RENDER_QUEUE_OVERLAY, false, 3000));
+        resourceProvider_ = guiRenderer_->createResourceProvider();
+        resourceProvider_->setDefaultResourceGroup("GUI");
+
+        // setup scripting
+        scriptModule_.reset(new LuaScriptModule());
+        luaState_ = scriptModule_->getLuaState();
+
+        // Create our own logger to specify the filepath
+        std::auto_ptr<CEGUILogger> ceguiLogger(new CEGUILogger());
+        ceguiLogger->setLogFilename(Core::getLogPathString() + "cegui.log");
+        // set the log level according to ours (translate by subtracting 1)
+        ceguiLogger->setLoggingLevel(
+            static_cast<LoggingLevel>(Core::getSoftDebugLevel(OutputHandler::LD_Logfile) - 1));
+        this->ceguiLogger_ = ceguiLogger.release();
+
+        // create the CEGUI system singleton
+        guiSystem_.reset(new System(guiRenderer_.get(), resourceProvider_, 0, scriptModule_.get()));
+
+        // do this after 'new CEGUI::Sytem' because that creates the lua state in the first place
+        LuaState::openToluaInterfaces(this->luaState_);
+
+        // initialise the basic lua code
+        this->loadLuaCode();
     }
 
Index: /code/branches/resource2/src/core/Game.cc
===================================================================
--- /code/branches/resource2/src/core/Game.cc	(revision 5657)
+++ /code/branches/resource2/src/core/Game.cc	(revision 5658)
@@ -37,4 +37,5 @@
 #include <exception>
 #include <boost/weak_ptr.hpp>
+#include <CEGUIExceptions.h>
 
 #include "util/Debug.h"
@@ -197,6 +198,10 @@
 
             // Core preUpdate (doesn't throw)
-            if (!this->core_->preUpdate(*this->gameClock_))
-            {
+            try
+                { this->core_->preUpdate(*this->gameClock_); }
+            catch (...)
+            {
+                COUT(0) << "An exception occurred in the Core preUpdate: " << Game::getExceptionMessage() << std::endl;
+                COUT(0) << "This should really never happen! Closing the program." << std::endl;
                 this->stop();
                 break;
@@ -207,6 +212,10 @@
 
             // Core postUpdate (doesn't throw)
-            if (!this->core_->postUpdate(*this->gameClock_))
-            {
+            try
+                { this->core_->postUpdate(*this->gameClock_); }
+            catch (...)
+            {
+            COUT(0) << "An exception occurred in the Core postUpdate: " << Game::getExceptionMessage() << std::endl;
+            COUT(0) << "This should really never happen! Closing the program." << std::endl;
                 this->stop();
                 break;
@@ -241,10 +250,10 @@
                     this->loadState(requestedStateNode->name_);
                 }
-                catch (const std::exception& ex)
+                catch (...)
                 {
-                    COUT(1) << "Error: Loading GameState '" << requestedStateNode->name_ << "' failed: " << ex.what() << std::endl;
+                    COUT(1) << "Error: Loading GameState '" << requestedStateNode->name_ << "' failed: " << Game::getExceptionMessage() << std::endl;
                     // All scheduled operations have now been rendered inert --> flush them and issue a warning
                     if (this->requestedStateNodes_.size() > 1)
-                        COUT(1) << "All " << this->requestedStateNodes_.size() - 1 << " scheduled transitions have been ignored." << std::endl;
+                        COUT(4) << "All " << this->requestedStateNodes_.size() - 1 << " scheduled transitions have been ignored." << std::endl;
                     this->requestedStateNodes_.clear();
                     break;
@@ -262,5 +271,4 @@
             it != this->loadedStates_.end(); ++it)
         {
-            std::string exceptionMessage;
             try
             {
@@ -273,11 +281,7 @@
                     this->subtractTickTime(static_cast<int32_t>(this->gameClock_->getRealMicroseconds() - timeBeforeTick));
             }
-            catch (const std::exception& ex)
-            { exceptionMessage = ex.what(); }
             catch (...)
-            { exceptionMessage = "Unknown exception"; }
-            if (!exceptionMessage.empty())
-            {
-                COUT(1) << "An exception occurred while updating '" << (*it)->getName() << "': " << exceptionMessage << std::endl;
+            {
+                COUT(1) << "An exception occurred while updating '" << (*it)->getName() << "': " << Game::getExceptionMessage() << std::endl;
                 COUT(1) << "This should really never happen!" << std::endl;
                 COUT(1) << "Unloading all GameStates depending on the one that crashed." << std::endl;
@@ -585,16 +589,46 @@
             state->deactivate();
         }
+        catch (...)
+        {
+            COUT(2) << "Warning: Unloading GameState '" << name << "' threw an exception: " << Game::getExceptionMessage() << std::endl;
+            COUT(2) << "         There might be potential resource leaks involved! To avoid this, improve exception-safety." << std::endl;
+        }
+        // Check if graphics is still required
+        if (!bAbort_)
+        {
+            bool graphicsRequired = false;
+            for (unsigned i = 0; i < loadedStates_.size(); ++i)
+                graphicsRequired |= loadedStates_[i]->getInfo().bGraphicsMode;
+            if (!graphicsRequired)
+                this->unloadGraphics();
+        }
+        this->bChangingState_ = false;
+    }
+
+    /*static*/ std::string Game::getExceptionMessage()
+    {
+        std::string exceptionMessage;
+        try
+        {
+            // rethrow
+            throw;
+        }
         catch (const std::exception& ex)
         {
-            COUT(2) << "Warning: Unloading GameState '" << name << "' threw an exception: " << ex.what() << std::endl;
-            COUT(2) << "         There might be potential resource leaks involved! To avoid this, improve exception-safety." << std::endl;
-        }
-        // Check if graphics is still required
-        bool graphicsRequired = false;
-        for (unsigned i = 0; i < loadedStates_.size(); ++i)
-            graphicsRequired |= loadedStates_[i]->getInfo().bGraphicsMode;
-        if (!graphicsRequired)
-            this->unloadGraphics();
-        this->bChangingState_ = false;
+            return ex.what();
+        }
+        catch (const CEGUI::Exception& ex)
+        {
+#if CEGUI_VERSION_MAJOR == 0 && CEGUI_VERSION_MINOR < 6
+            return GeneralException(ex.getMessage().c_str()).getDescription();
+#else
+            return GeneralException(ex.getMessage().c_str(), ex.getLine(),
+                ex.getFileName().c_str(), ex.getName().c_str()).getDescription();
+#endif
+        }
+        catch (...)
+        {
+            return "Unknown exception";
+        }
     }
 
Index: /code/branches/resource2/src/core/Game.h
===================================================================
--- /code/branches/resource2/src/core/Game.h	(revision 5657)
+++ /code/branches/resource2/src/core/Game.h	(revision 5658)
@@ -151,4 +151,11 @@
         // ScopeGuard helper function
         void resetChangingState() { this->bChangingState_ = false; }
+        /**
+        @brief
+            Retrieves information from an exception caught with "..."
+        @remarks
+            Never ever call this function without an exception in the stack!
+        */
+        static std::string getExceptionMessage();
 
         scoped_ptr<Clock>                  gameClock_;
Index: /code/branches/resource2/src/core/GraphicsManager.cc
===================================================================
--- /code/branches/resource2/src/core/GraphicsManager.cc	(revision 5657)
+++ /code/branches/resource2/src/core/GraphicsManager.cc	(revision 5658)
@@ -152,4 +152,6 @@
     @remarks
         This operation is irreversible without recreating the GraphicsManager!
+        So if it throws you HAVE to recreate the GraphicsManager!!!
+        It therefore offers almost no exception safety.
     */
     void GraphicsManager::upgradeToGraphics()
