aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals <albert.astals@canonical.com>2014-02-28 12:39:58 +0000
committerTarmac <>2014-02-28 12:39:58 +0000
commit788ebe3e81885b48051087afb4d8256366d7d262 (patch)
tree85ff15cee145e5b07038d4f5e4a83edba349b1c9
parent24aa85ffbd8d84f0cb7cb1e5d66fc4ca1d934f38 (diff)
parent7b70ef5dae3e27317725942b9eb158adcaed24ee (diff)
downloadqmenumodel-788ebe3e81885b48051087afb4d8256366d7d262.tar.gz
qmenumodel-788ebe3e81885b48051087afb4d8256366d7d262.tar.bz2
qmenumodel-788ebe3e81885b48051087afb4d8256366d7d262.zip
Fix use of un-initialized memory
Since m_valid was not initialized calling setValid ends up in an uninitialized memory use in the if comparison. The other thing setValid does is emitting a signal, but this is the constructor, so you don't need the signal either, so basically just assign the variable directly . Approved by PS Jenkins bot, Lars Uebernickel.
-rw-r--r--libqmenumodel/src/qstateaction.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/libqmenumodel/src/qstateaction.cpp b/libqmenumodel/src/qstateaction.cpp
index 40d70a5..983064a 100644
--- a/libqmenumodel/src/qstateaction.cpp
+++ b/libqmenumodel/src/qstateaction.cpp
@@ -62,9 +62,8 @@ QStateAction::QStateAction(QDBusActionGroup *group, const QString &name)
- bool isValid = m_group->hasAction(name);
- setValid(isValid);
- if (isValid) {
+ m_valid = m_group->hasAction(name);
+ if (m_valid) {
setState(m_group->actionState(name));
}
}