From 71f1a53090fc8d42b539101eff8bae372698a36d Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Tue, 13 Nov 2018 10:00:12 +0400 Subject: [PATCH 1/2] Improve tooltips cleanup (bug #4714) --- CHANGELOG.md | 1 + apps/openmw/mwgui/tooltips.cpp | 15 +++++++++++++++ apps/openmw/mwgui/tooltips.hpp | 2 ++ apps/openmw/mwgui/windowmanagerimp.cpp | 2 +- 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d686b668..18b0b99fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Bug #3623: Fix HiDPI on Windows Bug #4540: Rain delay when exiting water Bug #4701: PrisonMarker record is not hardcoded like other markers + Bug #4714: Crash upon game load in the repair menu while the "Your repair failed!" message is active Feature #2229: Improve pathfinding AI Feature #3442: Default values for fallbacks from ini file Feature #4673: Weapon sheathing diff --git a/apps/openmw/mwgui/tooltips.cpp b/apps/openmw/mwgui/tooltips.cpp index 0bd0d191c..b8a866402 100644 --- a/apps/openmw/mwgui/tooltips.cpp +++ b/apps/openmw/mwgui/tooltips.cpp @@ -330,6 +330,21 @@ namespace MWGui } } + void ToolTips::clear() + { + mFocusObject = MWWorld::Ptr(); + + while (mDynamicToolTipBox->getChildCount()) + { + MyGUI::Gui::getInstance().destroyWidget(mDynamicToolTipBox->getChildAt(0)); + } + + for (unsigned int i=0; i < mMainWidget->getChildCount(); ++i) + { + mMainWidget->getChildAt(i)->setVisible(false); + } + } + void ToolTips::setFocusObject(const MWWorld::Ptr& focus) { mFocusObject = focus; diff --git a/apps/openmw/mwgui/tooltips.hpp b/apps/openmw/mwgui/tooltips.hpp index 1ef473b5a..3b8e8b2cc 100644 --- a/apps/openmw/mwgui/tooltips.hpp +++ b/apps/openmw/mwgui/tooltips.hpp @@ -59,6 +59,8 @@ namespace MWGui void setDelay(float delay); + void clear(); + void setFocusObject(const MWWorld::Ptr& focus); void setFocusObjectScreenCoords(float min_x, float min_y, float max_x, float max_y); ///< set the screen-space position of the tooltip for focused object diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index f02314de6..dc82cad9c 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -1728,7 +1728,7 @@ namespace MWGui mMessageBoxManager->clear(); - mToolTips->setFocusObject(MWWorld::Ptr()); + mToolTips->clear(); mSelectedSpell.clear(); mCustomMarkers.clear(); From 5e071e3eb02685a6da6988ce4fff40bc72c5040b Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Tue, 13 Nov 2018 10:32:23 +0400 Subject: [PATCH 2/2] Add a missing check if mPtr is empty (bug #4715) --- CHANGELOG.md | 1 + apps/openmw/mwgui/dialogue.cpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18b0b99fc..2bb06874b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Bug #4540: Rain delay when exiting water Bug #4701: PrisonMarker record is not hardcoded like other markers Bug #4714: Crash upon game load in the repair menu while the "Your repair failed!" message is active + Bug #4715: "Cannot get class of an empty object" exception after pressing ESC in the dialogue mode Feature #2229: Improve pathfinding AI Feature #3442: Default values for fallbacks from ini file Feature #4673: Weapon sheathing diff --git a/apps/openmw/mwgui/dialogue.cpp b/apps/openmw/mwgui/dialogue.cpp index 3ac8839e2..dfb2b15b9 100644 --- a/apps/openmw/mwgui/dialogue.cpp +++ b/apps/openmw/mwgui/dialogue.cpp @@ -740,6 +740,9 @@ namespace MWGui bool DialogueWindow::isCompanion(const MWWorld::Ptr& actor) { + if (actor.isEmpty()) + return false; + return !actor.getClass().getScript(actor).empty() && actor.getRefData().getLocals().getIntVar(actor.getClass().getScript(actor), "companion"); }