diff options
author | Rainer Keller <rainer.keller@qt.io> | 2022-10-21 09:59:48 +0200 |
---|---|---|
committer | Rainer Keller <Rainer.Keller@qt.io> | 2022-10-21 12:04:09 +0000 |
commit | 6493f2793f05a56f8a2fafc62afb03c4ce6aad18 (patch) | |
tree | 76f04777668418c5de29aadd166cf42d759ce90c | |
parent | 42481ced3566a3f4145ce9100f8f7dc5b2a534ba (diff) |
McuSupport: Prevent multiple packages writing to the same key
Writing with an empty settings key will result in multiple packages writing
their value in the same key "Package_", with the suffix missing,
overwriting each other.
Change-Id: Iee3e042a2d9d5d1f4e34b903360129ba25b6f6ea
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Yasser Grimes <yasser.grimes@qt.io>
Reviewed-by: hjk <hjk@qt.io>
-rw-r--r-- | src/plugins/mcusupport/mcupackage.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/mcusupport/mcupackage.cpp b/src/plugins/mcusupport/mcupackage.cpp index f7f29ba4565..2b03a696c19 100644 --- a/src/plugins/mcusupport/mcupackage.cpp +++ b/src/plugins/mcusupport/mcupackage.cpp @@ -221,6 +221,12 @@ QString McuPackage::statusText() const bool McuPackage::writeToSettings() const { + if (m_settingsKey.isEmpty()) { + // Writing with an empty settings key will result in multiple packages writing their value + // in the same key "Package_", with the suffix missing, overwriting each other. + return false; + } + return settingsHandler->write(m_settingsKey, m_path, m_defaultPath); } |