summaryrefslogtreecommitdiffstats
path: root/common/propertymapper.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-02-16 10:29:27 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-02-16 10:39:59 +0100
commit768c1077b0d226d832f34904e929c2462eca158f (patch)
tree62ebe65b534ce4028ff24f29a0824540810179ff /common/propertymapper.cpp
parent80f8c4a48b8cbb359c4efdb9a13485bf86b4d1ed (diff)
downloadsink-768c1077b0d226d832f34904e929c2462eca158f.tar.gz
sink-768c1077b0d226d832f34904e929c2462eca158f.zip
Remember whether a blob property is external or not.
...we used to accidentally move external blobs after the property was lost when storing the modificatoin in the queue.
Diffstat (limited to 'common/propertymapper.cpp')
-rw-r--r--common/propertymapper.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/common/propertymapper.cpp b/common/propertymapper.cpp
index 4cfe154..4d45644 100644
--- a/common/propertymapper.cpp
+++ b/common/propertymapper.cpp
@@ -36,7 +36,9 @@ template <>
36flatbuffers::uoffset_t variantToProperty<Sink::ApplicationDomain::BLOB>(const QVariant &property, flatbuffers::FlatBufferBuilder &fbb) 36flatbuffers::uoffset_t variantToProperty<Sink::ApplicationDomain::BLOB>(const QVariant &property, flatbuffers::FlatBufferBuilder &fbb)
37{ 37{
38 if (property.isValid()) { 38 if (property.isValid()) {
39 return fbb.CreateString(property.value<Sink::ApplicationDomain::BLOB>().value.toStdString()).o; 39 const auto blob = property.value<Sink::ApplicationDomain::BLOB>();
40 auto s = blob.value + (blob.isExternal ? ":ext" : ":int");
41 return fbb.CreateString(s.toStdString()).o;
40 } 42 }
41 return 0; 43 return 0;
42} 44}
@@ -133,7 +135,13 @@ QVariant propertyToVariant<Sink::ApplicationDomain::BLOB>(const flatbuffers::Str
133{ 135{
134 if (property) { 136 if (property) {
135 // We have to copy the memory, otherwise it would become eventually invalid 137 // We have to copy the memory, otherwise it would become eventually invalid
136 return QVariant::fromValue(Sink::ApplicationDomain::BLOB{QString::fromStdString(property->c_str())}); 138 auto s = QString::fromStdString(property->c_str());
139 auto ext = s.endsWith(":ext");
140 s.chop(4);
141
142 auto blob = Sink::ApplicationDomain::BLOB{s};
143 blob.isExternal = ext;
144 return QVariant::fromValue(blob);
137 } 145 }
138 return QVariant(); 146 return QVariant();
139} 147}