mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-10 03:39:55 +00:00
Handle MyGUI exceptions inside destructors
This commit is contained in:
parent
aca6625af4
commit
c2c24a76a4
@ -6,6 +6,8 @@
|
||||
#include <MyGUI_Gui.h>
|
||||
#include <MyGUI_Window.h>
|
||||
|
||||
#include <components/debug/debuglog.hpp>
|
||||
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
|
||||
@ -49,7 +51,14 @@ KeyboardNavigation::KeyboardNavigation()
|
||||
|
||||
KeyboardNavigation::~KeyboardNavigation()
|
||||
{
|
||||
MyGUI::WidgetManager::getInstance().unregisterUnlinker(this);
|
||||
try
|
||||
{
|
||||
MyGUI::WidgetManager::getInstance().unregisterUnlinker(this);
|
||||
}
|
||||
catch(const MyGUI::Exception& e)
|
||||
{
|
||||
Log(Debug::Error) << "Error in the destructor: " << e.what();
|
||||
}
|
||||
}
|
||||
|
||||
void KeyboardNavigation::saveFocus(int mode)
|
||||
|
@ -5,6 +5,8 @@
|
||||
#include <MyGUI_WidgetDefines.h>
|
||||
#include <MyGUI_Widget.h>
|
||||
|
||||
#include <components/debug/debuglog.hpp>
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
/** The Layout class is an utility class used to load MyGUI layouts
|
||||
@ -16,7 +18,17 @@ namespace MWGui
|
||||
Layout(const std::string & _layout, MyGUI::Widget* _parent = nullptr)
|
||||
: mMainWidget(nullptr)
|
||||
{ initialise(_layout, _parent); }
|
||||
virtual ~Layout() { shutdown(); }
|
||||
virtual ~Layout()
|
||||
{
|
||||
try
|
||||
{
|
||||
shutdown();
|
||||
}
|
||||
catch(const MyGUI::Exception& e)
|
||||
{
|
||||
Log(Debug::Error) << "Error in the destructor: " << e.what();
|
||||
}
|
||||
}
|
||||
|
||||
MyGUI::Widget* getWidget(const std::string& _name);
|
||||
|
||||
|
@ -99,7 +99,14 @@ namespace MWGui
|
||||
|
||||
ScreenFader::~ScreenFader()
|
||||
{
|
||||
MyGUI::Gui::getInstance().eventFrameStart -= MyGUI::newDelegate(this, &ScreenFader::onFrameStart);
|
||||
try
|
||||
{
|
||||
MyGUI::Gui::getInstance().eventFrameStart -= MyGUI::newDelegate(this, &ScreenFader::onFrameStart);
|
||||
}
|
||||
catch(const MyGUI::Exception& e)
|
||||
{
|
||||
Log(Debug::Error) << "Error in the destructor: " << e.what();
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenFader::onFrameStart(float dt)
|
||||
|
@ -518,35 +518,42 @@ namespace MWGui
|
||||
|
||||
WindowManager::~WindowManager()
|
||||
{
|
||||
mKeyboardNavigation.reset();
|
||||
try
|
||||
{
|
||||
mKeyboardNavigation.reset();
|
||||
|
||||
MyGUI::LanguageManager::getInstance().eventRequestTag.clear();
|
||||
MyGUI::PointerManager::getInstance().eventChangeMousePointer.clear();
|
||||
MyGUI::InputManager::getInstance().eventChangeKeyFocus.clear();
|
||||
MyGUI::ClipboardManager::getInstance().eventClipboardChanged.clear();
|
||||
MyGUI::ClipboardManager::getInstance().eventClipboardRequested.clear();
|
||||
MyGUI::LanguageManager::getInstance().eventRequestTag.clear();
|
||||
MyGUI::PointerManager::getInstance().eventChangeMousePointer.clear();
|
||||
MyGUI::InputManager::getInstance().eventChangeKeyFocus.clear();
|
||||
MyGUI::ClipboardManager::getInstance().eventClipboardChanged.clear();
|
||||
MyGUI::ClipboardManager::getInstance().eventClipboardRequested.clear();
|
||||
|
||||
for (WindowBase* window : mWindows)
|
||||
delete window;
|
||||
mWindows.clear();
|
||||
for (WindowBase* window : mWindows)
|
||||
delete window;
|
||||
mWindows.clear();
|
||||
|
||||
delete mMessageBoxManager;
|
||||
delete mLocalMapRender;
|
||||
delete mCharGen;
|
||||
delete mDragAndDrop;
|
||||
delete mSoulgemDialog;
|
||||
delete mCursorManager;
|
||||
delete mToolTips;
|
||||
delete mMessageBoxManager;
|
||||
delete mLocalMapRender;
|
||||
delete mCharGen;
|
||||
delete mDragAndDrop;
|
||||
delete mSoulgemDialog;
|
||||
delete mCursorManager;
|
||||
delete mToolTips;
|
||||
|
||||
cleanupGarbage();
|
||||
cleanupGarbage();
|
||||
|
||||
mFontLoader.reset();
|
||||
mFontLoader.reset();
|
||||
|
||||
mGui->shutdown();
|
||||
delete mGui;
|
||||
mGui->shutdown();
|
||||
delete mGui;
|
||||
|
||||
mGuiPlatform->shutdown();
|
||||
delete mGuiPlatform;
|
||||
mGuiPlatform->shutdown();
|
||||
delete mGuiPlatform;
|
||||
}
|
||||
catch(const MyGUI::Exception& e)
|
||||
{
|
||||
Log(Debug::Error) << "Error in the destructor: " << e.what();
|
||||
}
|
||||
}
|
||||
|
||||
void WindowManager::setStore(const MWWorld::ESMStore &store)
|
||||
|
@ -161,7 +161,17 @@ namespace Gui
|
||||
mTextures.clear();
|
||||
|
||||
for (std::vector<MyGUI::ResourceManualFont*>::iterator it = mFonts.begin(); it != mFonts.end(); ++it)
|
||||
MyGUI::ResourceManager::getInstance().removeByName((*it)->getResourceName());
|
||||
{
|
||||
try
|
||||
{
|
||||
MyGUI::ResourceManager::getInstance().removeByName((*it)->getResourceName());
|
||||
}
|
||||
catch(const MyGUI::Exception& e)
|
||||
{
|
||||
Log(Debug::Error) << "Error in the destructor: " << e.what();
|
||||
}
|
||||
}
|
||||
|
||||
mFonts.clear();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user