aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qdeferredpointer_p.h
diff options
context:
space:
mode:
authorSami Shalayel <sami.shalayel@qt.io>2025-01-06 15:45:58 +0100
committerSami Shalayel <sami.shalayel@qt.io>2025-01-15 14:07:07 +0100
commit689139203e7acded64a235125edd83f3a1106d6c (patch)
tree8367cd95fe2ac8f12556639749043a613f2780e5 /src/qmlcompiler/qdeferredpointer_p.h
parent76359a60a583e0d20aa97fced3db11302d30068e (diff)
QDeferredSharedPointer: don't populate eagerly on factory reset
Do not populate a pointer eagerly if it was already populated when its factory got reset. Instead reset the underlying shared pointer to delete the stale data. Amends 13761ee3c7d6ecb756db490d8c1fa8980117dca4 that wanted to avoid having stale data around. Add a test that reproduces the stack overflow when the pointer get eagerly populated, and make sure the stack size is big enough even for asan builds. Fixes: QTBUG-132134 Pick-to: 6.8 6.9 Change-Id: I8e2a5ce7fc99b1ec33d31535dc6b2675ab623349 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qmlcompiler/qdeferredpointer_p.h')
-rw-r--r--src/qmlcompiler/qdeferredpointer_p.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/qmlcompiler/qdeferredpointer_p.h b/src/qmlcompiler/qdeferredpointer_p.h
index 4bd3b18326..e0f6cf968f 100644
--- a/src/qmlcompiler/qdeferredpointer_p.h
+++ b/src/qmlcompiler/qdeferredpointer_p.h
@@ -155,12 +155,10 @@ public:
return (m_factory && m_factory->isValid()) ? m_factory.data() : nullptr;
}
- void resetFactory(const Factory& newFactory) const
+ void resetFactory(const Factory& newFactory)
{
- const bool wasAlreadyLoaded = !factory();
+ m_data.reset();
*m_factory = newFactory;
- if (wasAlreadyLoaded)
- lazyLoad();
}
private: