[dasher: 93/217] Fix for deleted memory read
- From: Patrick Welche <pwelche src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dasher: 93/217] Fix for deleted memory read
- Date: Sat, 27 Feb 2016 12:08:08 +0000 (UTC)
commit 915f4e978b13215d591efe99153b910e2978bb31
Author: ipomoena <amajorek google com>
Date: Sat Oct 17 21:00:02 2015 -0700
Fix for deleted memory read
Src/DasherCore/ControlManager.cpp | 5 +++--
Src/DasherCore/DasherInterfaceBase.cpp | 8 +++-----
Src/DasherCore/NodeCreationManager.cpp | 4 ----
Src/DasherCore/NodeCreationManager.h | 2 --
4 files changed, 6 insertions(+), 13 deletions(-)
---
diff --git a/Src/DasherCore/ControlManager.cpp b/Src/DasherCore/ControlManager.cpp
index 1f1e04c..5c20a6c 100644
--- a/Src/DasherCore/ControlManager.cpp
+++ b/Src/DasherCore/ControlManager.cpp
@@ -400,8 +400,9 @@ CControlBase::Action *CControlManager::parseAction(const XML_Char *name, const X
key << " " << arg.first << "=" << arg.second;
}
}
- if (auto action = m_actions[key.str()])
- return action;
+ auto it = m_actions.find(key.str());
+ if (it != m_actions.end())
+ return it->second;
return CControlParser::parseAction(name, atts);
}
diff --git a/Src/DasherCore/DasherInterfaceBase.cpp b/Src/DasherCore/DasherInterfaceBase.cpp
index 073d167..809b0ac 100644
--- a/Src/DasherCore/DasherInterfaceBase.cpp
+++ b/Src/DasherCore/DasherInterfaceBase.cpp
@@ -288,11 +288,9 @@ void CDasherInterfaceBase::HandleEvent(int iParameter) {
m_pWordSpeaker = GetBoolParameter(BP_SPEAK_WORDS) ? new WordSpeaker(this) : NULL;
break;
case BP_CONTROL_MODE:
- //force rebuilding tree/nodes, to get new probabilities (inc/exc control node).
- // This may move the canvas around a bit, but at least manages to keep/reuse the
- // existing AlphabetManager, NCManager, etc. objects...
- SetOffset(m_pDasherModel->GetOffset(), true);
- break;
+ // force rebuilding every node. If not control box is accessed after delete.
+ CreateNCManager();
+ break;
default:
break;
}
diff --git a/Src/DasherCore/NodeCreationManager.cpp b/Src/DasherCore/NodeCreationManager.cpp
index 7b405e7..3399462 100644
--- a/Src/DasherCore/NodeCreationManager.cpp
+++ b/Src/DasherCore/NodeCreationManager.cpp
@@ -126,10 +126,6 @@ void CNodeCreationManager::ChangeScreen(CDasherScreen *pScreen) {
if (m_pControlManager) m_pControlManager->ChangeScreen(pScreen);
}
-void CNodeCreationManager::HandleEvent(int iParameter) {
- if (iParameter==BP_CONTROL_MODE) updateControl();
-}
-
void CNodeCreationManager::updateControl() {
delete m_pControlManager;
unsigned long iControlSpace;
diff --git a/Src/DasherCore/NodeCreationManager.h b/Src/DasherCore/NodeCreationManager.h
index c9d3bf2..682ebed 100644
--- a/Src/DasherCore/NodeCreationManager.h
+++ b/Src/DasherCore/NodeCreationManager.h
@@ -37,8 +37,6 @@ class CNodeCreationManager : public Dasher::CSettingsUserObserver {
/// BP_CONTROL_MODE and game mode status)
void updateControl();
- //Watch for changes to BP_CONTROL_MODE and call updateControl() as necessary
- void HandleEvent(int iParameter);
///
/// Get a root node of a particular type
///
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]