summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmMakefile.cxx9
1 files changed, 8 insertions, 1 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 1abd467..31ce605 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2955,7 +2955,14 @@ std::string cmMakefile::GetListFileStack()
void cmMakefile::PushScope()
{
- this->DefinitionStack.push_back(this->DefinitionStack.back());
+ // Get the index of the next stack entry.
+ std::vector<DefinitionMap>::size_type index = this->DefinitionStack.size();
+
+ // Allocate a new stack entry.
+ this->DefinitionStack.push_back(DefinitionMap());
+
+ // Copy the previous top to the new top.
+ this->DefinitionStack[index] = this->DefinitionStack[index-1];
}
void cmMakefile::PopScope()