diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2019-01-24 09:07:50 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2019-01-24 08:40:42 +0000 |
commit | 67a30527691fced3a32ed0442bda35772ceb9d8d (patch) | |
tree | a239c64383a29e71fda1d139f52a4ee46e02fc32 | |
parent | c60b8ba4d4a61f5f2ca60b45e021bbdd43b73fce (diff) |
ModuleLoader: Do not validate property bindings in non-present modules
The check for the "not-present" condition was not thorough enough: If a
module was successfully loaded, but its validate script failed, then
we'd still check property assignments if they happened from within a
higher-level module instance.
Change-Id: I9d7281eb5603deaa04db008ab9fc340847d83151
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r-- | src/lib/corelib/language/moduleloader.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/lib/corelib/language/moduleloader.cpp b/src/lib/corelib/language/moduleloader.cpp index c4d77ba40..58dab062a 100644 --- a/src/lib/corelib/language/moduleloader.cpp +++ b/src/lib/corelib/language/moduleloader.cpp @@ -464,6 +464,27 @@ private: return; } + // If a module was found but its validate script failed, only the canonical + // module instance will have the "non-present" flag set, so we need to locate it. + if (item->type() == ItemType::ModuleInstance) { + const Item *productItem = nullptr; + for (auto it = m_parentItems.rbegin(); it != m_parentItems.rend(); ++it) { + if ((*it)->type() == ItemType::Product) { + productItem = *it; + break; + } + } + if (productItem) { + for (const Item::Module &m : productItem->modules()) { + if (m.name == m_currentModuleName) { + if (!m.item->isPresentModule()) + return; + break; + } + } + } + } + m_parentItems.push_back(item); for (Item::PropertyMap::const_iterator it = item->properties().constBegin(); it != item->properties().constEnd(); ++it) { |