summaryrefslogtreecommitdiff
path: root/src/Handle.cc
diff options
context:
space:
mode:
authorNicolas Noble <pixel@nobis-crew.org>2013-08-07 15:33:19 -0700
committerNicolas Noble <pixel@nobis-crew.org>2013-08-07 16:01:59 -0700
commit7f841bd54b8628420b4bec129fae86472b5dc565 (patch)
tree7eea1b2bdca9c260e3adf95efd18b33e470bf8ad /src/Handle.cc
parent06c4d6a7bca960a163cf45d37cc5f42684d6840d (diff)
Intriguing this one didn't crash earlier. We were writing that byte somewhere in the stack. Making the 'buffer' more persistent.
Diffstat (limited to 'src/Handle.cc')
-rw-r--r--src/Handle.cc9
1 files changed, 5 insertions, 4 deletions
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 <memory>
#include <typeinfo>
#include <errno.h>
#include "ev++.h"
@@ -96,10 +97,10 @@ ssize_t Balau::Handle::forceWrite(const void * _buf, size_t count, Events::BaseE
Balau::Future<uint8_t> Balau::Handle::readU8() {
IO<Handle> t(this);
- return Future<uint8_t>([t]() mutable {
- uint8_t b;
- t->read(&b, 1);
- return b;
+ std::shared_ptr<uint8_t> b(new uint8_t);
+ return Future<uint8_t>([t, b]() mutable {
+ t->read(b.get(), 1);
+ return *b;
});
}