summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Noetzli <andres.noetzli@gmail.com>2018-10-10 08:18:12 -0700
committerAndres Noetzli <andres.noetzli@gmail.com>2018-10-10 08:18:12 -0700
commita13a2f44e95c9b48ddd9f53b8e3b062dbfe9912e (patch)
treeab5c6a348996acc6f4eef76e82c50a109395051c
parent47ea4e83eeca167b57c371b20a1b2a8f1e4d515d (diff)
-rw-r--r--src/context/context.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/context/context.cpp b/src/context/context.cpp
index 67a4a1f49..8362438dd 100644
--- a/src/context/context.cpp
+++ b/src/context/context.cpp
@@ -209,6 +209,7 @@ ContextObj* ContextObj::restoreAndContinue()
Debug("context") << "NULL restore object! " << this << std::endl;
pContextObjNext = d_pContextObjNext;
+ d_pScope = nullptr;
// Nothing else to do
} else {
@@ -237,11 +238,6 @@ ContextObj* ContextObj::restoreAndContinue()
void ContextObj::destroy()
{
- /* Context can be big and complicated, so we only want to process this output
- * if we're really going to use it. (Same goes below.) */
- Debug("context") << "before destroy " << this << " (level " << getLevel()
- << "):" << std::endl << *getContext() << std::endl;
-
// Under rare circumstances, we could be trying to destroy an object that is
// invalid. In that case, the prev()/next() pointers are stale and must not
// be used. Since invalid objects have no old versions to restore and remove
@@ -251,7 +247,7 @@ void ContextObj::destroy()
// when calling the ContextObj constructor) and kept on the stack, we pop
// down to level 0 (the object keeps level 1 because it does not exist below
// that level), and at the end of the function the object is destroyed.
- if (getLevel() > getContext()->getLevel())
+ if (d_pScope == nullptr)
{
Assert(d_pContextObjRestore == NULL);
Debug("context") << "skipping destroy because object already invalid"
@@ -259,6 +255,11 @@ void ContextObj::destroy()
return;
}
+ /* Context can be big and complicated, so we only want to process this output
+ * if we're really going to use it. (Same goes below.) */
+ Debug("context") << "before destroy " << this << " (level " << getLevel()
+ << "):" << std::endl << *getContext() << std::endl;
+
for(;;) {
// If valgrind reports invalid writes on the next few lines,
// here's a hint: make sure all classes derived from ContextObj in
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback