diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-05-17 20:24:51 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-05-17 20:24:51 +0200 |
commit | c81fe1578e4151e230ffa08a6c5b26b535593ee7 (patch) | |
tree | b301309f15b9f70f52b05a13af756352bced84cb /common/entitybuffer.h | |
parent | eb54f3795fb276046c1a4c0e81fb5426f0659550 (diff) | |
download | sink-c81fe1578e4151e230ffa08a6c5b26b535593ee7.tar.gz sink-c81fe1578e4151e230ffa08a6c5b26b535593ee7.zip |
Copy the entity when we return it.
Otherwise we easily end up copying it and then have an entity that
points into nowhere. Callback -> no copy, no callback -> copy.
Diffstat (limited to 'common/entitybuffer.h')
-rw-r--r-- | common/entitybuffer.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/common/entitybuffer.h b/common/entitybuffer.h index 4162605..d73a138 100644 --- a/common/entitybuffer.h +++ b/common/entitybuffer.h | |||
@@ -12,7 +12,18 @@ struct Entity; | |||
12 | class SINK_EXPORT EntityBuffer | 12 | class SINK_EXPORT EntityBuffer |
13 | { | 13 | { |
14 | public: | 14 | public: |
15 | /** | ||
16 | * Creates an entity buffer from @param dataValue. | ||
17 | * | ||
18 | * Note that @param dataValue will need to remain valid and the data is not copied. | ||
19 | */ | ||
15 | EntityBuffer(const void *dataValue, int size); | 20 | EntityBuffer(const void *dataValue, int size); |
21 | |||
22 | /** | ||
23 | * Creates an entity buffer from @param data. | ||
24 | * | ||
25 | * Note that @param data will need to remain valid and the data is not copied. | ||
26 | */ | ||
16 | EntityBuffer(const QByteArray &data); | 27 | EntityBuffer(const QByteArray &data); |
17 | const uint8_t *resourceBuffer(); | 28 | const uint8_t *resourceBuffer(); |
18 | const uint8_t *metadataBuffer(); | 29 | const uint8_t *metadataBuffer(); |