diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-12-08 13:18:19 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-12-08 13:18:19 +0100 |
commit | ae4b64b198a143240aa5dd1e202e5016abfdae71 (patch) | |
tree | 5d9d58a512ebc60c44637d11c9424f67a02887e8 /common/typeindex.cpp | |
parent | f425c2070131161dc11bcf70e35f8d1848cadb65 (diff) | |
download | sink-ae4b64b198a143240aa5dd1e202e5016abfdae71.tar.gz sink-ae4b64b198a143240aa5dd1e202e5016abfdae71.zip |
Wrap references in a Reerence type.
This allows us to make sure that references are not taken out of
context (the resource).
Because we need to use the type-specific accessors more we also ran into
a problem that we cannot "downcast" a reference with the change
recording still working, for that we have the cast<T>() operator now.
Diffstat (limited to 'common/typeindex.cpp')
-rw-r--r-- | common/typeindex.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/common/typeindex.cpp b/common/typeindex.cpp index b0494f3..9d71463 100644 --- a/common/typeindex.cpp +++ b/common/typeindex.cpp | |||
@@ -34,6 +34,12 @@ static QByteArray getByteArray(const QVariant &value) | |||
34 | return "nodate"; | 34 | return "nodate"; |
35 | } | 35 | } |
36 | } | 36 | } |
37 | if (value.canConvert<Sink::ApplicationDomain::Reference>()) { | ||
38 | const auto ba = value.value<Sink::ApplicationDomain::Reference>().value; | ||
39 | if (!ba.isEmpty()) { | ||
40 | return ba; | ||
41 | } | ||
42 | } | ||
37 | if (value.isValid() && !value.toByteArray().isEmpty()) { | 43 | if (value.isValid() && !value.toByteArray().isEmpty()) { |
38 | return value.toByteArray(); | 44 | return value.toByteArray(); |
39 | } | 45 | } |