From 421520bda0d6cef1e7113cd17f068b17fc6172be Mon Sep 17 00:00:00 2001 From: Katarzyna Mitrus Date: Mon, 13 Jun 2022 11:11:30 +0200 Subject: [PATCH] Handle error from propagate_rt_info (#11773) --- src/core/src/op/slice.cpp | 2 +- src/core/src/validation_util.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/core/src/op/slice.cpp b/src/core/src/op/slice.cpp index bb55d49a002..ca27466a404 100644 --- a/src/core/src/op/slice.cpp +++ b/src/core/src/op/slice.cpp @@ -426,4 +426,4 @@ bool op::v8::Slice::evaluate_label(TensorLabelVector& output_labels) const { if (!slice_input_check(this)) return false; return default_label_evaluator(this, output_labels); -} \ No newline at end of file +} diff --git a/src/core/src/validation_util.cpp b/src/core/src/validation_util.cpp index 25d82517842..9206a8d830a 100644 --- a/src/core/src/validation_util.cpp +++ b/src/core/src/validation_util.cpp @@ -1203,8 +1203,13 @@ void propagate_rt_info(Node* node, const Output& final_port) { for (auto& in : output.get_target_inputs()) { if (stop_nodes.count(in.get_node())) continue; - auto consumer = in.get_node()->shared_from_this(); - copy_runtime_info({curr_node, consumer}, consumer); + try { + auto consumer = in.get_node()->shared_from_this(); + copy_runtime_info({curr_node, consumer}, consumer); + } catch (const std::bad_weak_ptr&) { + // Exception can be thrown, if `shared_from_this()` was called during node creation. + // Continue propagation for other nodes. + } } } }