summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-10-28 09:59:31 +0100
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-10-28 22:14:37 +0100
commit979c8cf1b75e3e0e0dcf7c718c3fed6fdfdd7ea3 (patch)
treecab043e054a026d11a09278b21de8c48c9828e60 /src/corelib
parentbcd2f3f99e8696fb2a21c1996895cd219245c424 (diff)
Always return initialized data from QBindable::value
clang warned about result being uninitialized if iface is nullptr. Return a properly initialized result in that case as well. This might break RVO, but the alternative is to always initialize result, even if we are going to call the getter anyway, which I assume would be more expensive. Change-Id: I5d6d243b3094b79bf021725d017be5c72b1089bb Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/kernel/qproperty.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/corelib/kernel/qproperty.h b/src/corelib/kernel/qproperty.h
index 9ee7a1ef3f..8b400e7285 100644
--- a/src/corelib/kernel/qproperty.h
+++ b/src/corelib/kernel/qproperty.h
@@ -651,10 +651,12 @@ public:
T value() const
{
- T result;
- if (iface)
+ if (iface) {
+ T result;
iface->getter(data, &result);
- return result;
+ return result;
+ }
+ return T{};
}
void setValue(const T &value)