diff options
author | Claudius "keldu" Holeksa <mail@keldu.de> | 2024-06-26 14:41:18 +0200 |
---|---|---|
committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2024-06-26 14:41:18 +0200 |
commit | df7789cbef7ffa9658c61525edf75bebaa6398ff (patch) | |
tree | 8b004a208910a9c38f20ec312fbb0e74a5a2c279 /modules/async | |
parent | eda37df9c399b23dc5bdb668730101a87f4770ce (diff) |
Got double free :/
Diffstat (limited to 'modules/async')
-rw-r--r-- | modules/async/c++/async.hpp | 10 | ||||
-rw-r--r-- | modules/async/c++/async.tmpl.hpp | 4 |
2 files changed, 8 insertions, 6 deletions
diff --git a/modules/async/c++/async.hpp b/modules/async/c++/async.hpp index 0f58536..ba994fd 100644 --- a/modules/async/c++/async.hpp +++ b/modules/async/c++/async.hpp @@ -287,7 +287,7 @@ public: * If no sink() or detach() is used you have to take elements out of the * chain yourself. */ - error_or<fix_void<T>> take(); + error_or<T> take(); /** @todo implement * Specifically pump elements through this chain with the provided @@ -758,10 +758,12 @@ public: func_, std::move(dep_eov.get_value())); } catch (const std::bad_alloc &) { eov = make_error<err::out_of_memory>("Out of memory"); - } catch (const std::exception &) { + } catch (const std::exception & e) { eov = make_error<err::invalid_state>( - "Exception in chain occured. Return ErrorOr<T> if you " - "want to handle errors which are recoverable"); + "Exception in chain occured. Return error_or<T> if you " + "want to handle errors which are recoverable." + "You might have thrown an exception in your code" + "which you haven't caught. Don't do that."); } } else if (dep_eov.is_error()) { eov = error_func_(std::move(dep_eov.get_error())); diff --git a/modules/async/c++/async.tmpl.hpp b/modules/async/c++/async.tmpl.hpp index 68489ad..7016283 100644 --- a/modules/async/c++/async.tmpl.hpp +++ b/modules/async/c++/async.tmpl.hpp @@ -160,14 +160,14 @@ own<conveyor_node> conveyor<T>::from_conveyor(conveyor<T> conveyor) { return std::move(conveyor.node_); } -template <typename T> error_or<fix_void<T>> conveyor<T>::take() { +template <typename T> error_or<T> conveyor<T>::take() { SAW_ASSERT(node_) { make_error<err::invalid_state>("conveyor in invalid state"); } conveyor_storage *storage = node_->next_storage(); if (storage) { if (storage->queued() > 0) { - error_or<fix_void<T>> result; + error_or<T> result; node_->get_result(result); return result; } else { |