[Orxonox-commit 2468] r7175 - code/trunk/src/libraries/core

rgrieder at orxonox.net rgrieder at orxonox.net
Wed Aug 18 00:12:42 CEST 2010


Author: rgrieder
Date: 2010-08-18 00:12:42 +0200 (Wed, 18 Aug 2010)
New Revision: 7175

Modified:
   code/trunk/src/libraries/core/Core.cc
Log:
Fixed a problem with Ogre 1.7 and our exception handling mechanism. Somehow Ogre exceptions don't like if you completely reload Ogre during throw and catch...
The fix is simple: Abort the program if graphics loading fails (but display the exception message).

Modified: code/trunk/src/libraries/core/Core.cc
===================================================================
--- code/trunk/src/libraries/core/Core.cc	2010-08-17 22:08:05 UTC (rev 7174)
+++ code/trunk/src/libraries/core/Core.cc	2010-08-17 22:12:42 UTC (rev 7175)
@@ -228,7 +228,23 @@
         Loki::ScopeGuard unloader = Loki::MakeObjGuard(*this, &Core::unloadGraphics);
 
         // Upgrade OGRE to receive a render window
-        graphicsManager_->upgradeToGraphics();
+        try
+        {
+            graphicsManager_->upgradeToGraphics();
+        }
+        catch (...)
+        {
+            // Recovery from this is very difficult. It requires to completely
+            // destroy Ogre related objects and load again (without graphics).
+            // However since Ogre 1.7 there seems to be a problem when Ogre
+            // throws an exception and the graphics engine then gets destroyed
+            // and reloaded between throw and catch (access violation in MSVC).
+            // That's why we abort completely and only display the exception.
+            COUT(0) << "An exception occurred during upgrade to graphics. "
+                    << "That is unrecoverable. The message was:" << endl
+                    << Exception::handleMessage() << endl;
+            abort();
+        }
 
         // Calls the InputManager which sets up the input devices.
         inputManager_.reset(new InputManager());




More information about the Orxonox-commit mailing list