From 7f841bd54b8628420b4bec129fae86472b5dc565 Mon Sep 17 00:00:00 2001 From: Nicolas Noble Date: Wed, 7 Aug 2013 15:33:19 -0700 Subject: Intriguing this one didn't crash earlier. We were writing that byte somewhere in the stack. Making the 'buffer' more persistent. --- src/Handle.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/Handle.cc b/src/Handle.cc index cc39f41..503787b 100644 --- a/src/Handle.cc +++ b/src/Handle.cc @@ -1,3 +1,4 @@ +#include #include #include #include "ev++.h" @@ -96,10 +97,10 @@ ssize_t Balau::Handle::forceWrite(const void * _buf, size_t count, Events::BaseE Balau::Future Balau::Handle::readU8() { IO t(this); - return Future([t]() mutable { - uint8_t b; - t->read(&b, 1); - return b; + std::shared_ptr b(new uint8_t); + return Future([t, b]() mutable { + t->read(b.get(), 1); + return *b; }); } -- cgit v1.2.3