summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormread <qt-info@nokia.com>2011-08-26 11:07:31 (GMT)
committermread <qt-info@nokia.com>2011-08-26 11:13:56 (GMT)
commita4eae8a44ca38739755ba8994251e2b120878ec8 (patch)
treebc6c578625c841f6cd4d4c9bdb3560614744e8af /src
parent338346ceae99ec0d8f7227af12333d63393992be (diff)
downloadQt-a4eae8a44ca38739755ba8994251e2b120878ec8.zip
Qt-a4eae8a44ca38739755ba8994251e2b120878ec8.tar.gz
Qt-a4eae8a44ca38739755ba8994251e2b120878ec8.tar.bz2
Fixed use of deleted object in XmlPatterns EvaluationCache
This problem was shown up by the Ilta-Sanomat QML app on Symbian. Changes to the EvaluationCache class in 23267553627ac3c4cbcd918283bee8e665deeff9 meant that it was now trying to access the declaration object after it had been deleted. This change takes the data needed from the declaration object (1 bool) and stores that instead Task-number: QTTH-1492 Reviewed-by: Honglei Zhang
Diffstat (limited to 'src')
-rw-r--r--src/xmlpatterns/expr/qevaluationcache.cpp5
-rw-r--r--src/xmlpatterns/expr/qevaluationcache_p.h2
2 files changed, 3 insertions, 4 deletions
diff --git a/src/xmlpatterns/expr/qevaluationcache.cpp b/src/xmlpatterns/expr/qevaluationcache.cpp
index 67109eb..3b6fc92 100644
--- a/src/xmlpatterns/expr/qevaluationcache.cpp
+++ b/src/xmlpatterns/expr/qevaluationcache.cpp
@@ -49,10 +49,9 @@ template<bool IsForGlobal>
EvaluationCache<IsForGlobal>::EvaluationCache(const Expression::Ptr &op,
const VariableDeclaration *varDecl,
const VariableSlotID aSlot) : SingleContainer(op)
- , m_declaration(varDecl)
+ , m_declarationUsedByMany(varDecl->usedByMany())
, m_varSlot(aSlot)
{
- Q_ASSERT(m_declaration);
Q_ASSERT(m_varSlot > -1);
}
@@ -199,7 +198,7 @@ Expression::Ptr EvaluationCache<IsForGlobal>::compress(const StaticContext::Ptr
if(m_operand->is(IDRangeVariableReference))
return m_operand;
- if(m_declaration->usedByMany())
+ if (m_declarationUsedByMany)
{
/* If it's only an atomic value an EvaluationCache is overkill. However,
* it's still needed for functions like fn:current-time() that must adhere to
diff --git a/src/xmlpatterns/expr/qevaluationcache_p.h b/src/xmlpatterns/expr/qevaluationcache_p.h
index 6080157..77d9c11 100644
--- a/src/xmlpatterns/expr/qevaluationcache_p.h
+++ b/src/xmlpatterns/expr/qevaluationcache_p.h
@@ -124,7 +124,7 @@ namespace QPatternist
private:
static DynamicContext::Ptr topFocusContext(const DynamicContext::Ptr &context);
- const VariableDeclaration *m_declaration;
+ bool m_declarationUsedByMany;
/**
* This variable must not be called m_slot. If it so, a compiler bug on
* HP-UX-aCC-64 is triggered in the constructor initializor. See the