From 14647325d2ae8c2c8793b7c0594dcb49f90af877 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Thu, 3 Nov 2016 18:05:32 +0100 Subject: [PATCH] fixed --- src/uvw/fs.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/uvw/fs.hpp b/src/uvw/fs.hpp index 6e0fcdf4..6eee32c1 100644 --- a/src/uvw/fs.hpp +++ b/src/uvw/fs.hpp @@ -478,7 +478,8 @@ public: * @param offset Offset, as described in the official documentation. */ void write(std::unique_ptr data, ssize_t len, int64_t offset) { - uv_buf_t bufs[] = { uv_buf_init(data.get(), len) }; + this->data = std::move(data); + uv_buf_t bufs[] = { uv_buf_init(this->data.get(), len) }; cleanupAndInvoke(&uv_fs_write, parent(), get(), file, bufs, 1, offset, &fsResultCallback); } @@ -494,7 +495,8 @@ public: * * The amount of data written to the given path. */ std::pair writeSync(std::unique_ptr data, ssize_t len, int64_t offset) { - uv_buf_t bufs[] = { uv_buf_init(data.get(), len) }; + this->data = std::move(data); + uv_buf_t bufs[] = { uv_buf_init(this->data.get(), len) }; auto req = get(); cleanupAndInvokeSync(&uv_fs_write, parent(), req, file, bufs, 1, offset); return std::make_pair(!(req->result < 0), req->result);