diff --git a/src/corelib/tools/qringbuffer.cpp b/src/corelib/tools/qringbuffer.cpp index f59dcc39c4d..f32673b9bd7 100644 --- a/src/corelib/tools/qringbuffer.cpp +++ b/src/corelib/tools/qringbuffer.cpp @@ -62,7 +62,7 @@ void QRingChunk::detach() tailOffset = chunkSize; } -QByteArray QRingChunk::toByteArray() +QByteArray QRingChunk::toByteArray() && { if (headOffset != 0 || tailOffset != chunk.size()) { if (isShared()) @@ -79,7 +79,7 @@ QByteArray QRingChunk::toByteArray() chunk.resize(tailOffset); } - return chunk; + return std::move(chunk); } /*! diff --git a/src/corelib/tools/qringbuffer_p.h b/src/corelib/tools/qringbuffer_p.h index d01c31b8617..1ab0053d1ac 100644 --- a/src/corelib/tools/qringbuffer_p.h +++ b/src/corelib/tools/qringbuffer_p.h @@ -114,7 +114,7 @@ public: return !chunk.isDetached(); } Q_CORE_EXPORT void detach(); - QByteArray toByteArray(); + QByteArray toByteArray() &&; // getters inline qsizetype head() const