From df7789cbef7ffa9658c61525edf75bebaa6398ff Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Wed, 26 Jun 2024 14:41:18 +0200 Subject: Got double free :/ --- modules/async/c++/async.hpp | 10 ++++++---- modules/async/c++/async.tmpl.hpp | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'modules/async/c++') 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> take(); + error_or 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("Out of memory"); - } catch (const std::exception &) { + } catch (const std::exception & e) { eov = make_error( - "Exception in chain occured. Return ErrorOr if you " - "want to handle errors which are recoverable"); + "Exception in chain occured. Return error_or 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::from_conveyor(conveyor conveyor) { return std::move(conveyor.node_); } -template error_or> conveyor::take() { +template error_or conveyor::take() { SAW_ASSERT(node_) { make_error("conveyor in invalid state"); } conveyor_storage *storage = node_->next_storage(); if (storage) { if (storage->queued() > 0) { - error_or> result; + error_or result; node_->get_result(result); return result; } else { -- cgit v1.2.3