From 2eb53ba3b21bf1a36ce2805bf4439f52de7182b5 Mon Sep 17 00:00:00 2001 From: Omar Emara Date: Mon, 16 Dec 2024 11:13:30 +0200 Subject: [PATCH] Fix: Memory leak when compositor contains unavailable links The compositor leaks memory when the node tree contains unavailable links. That's because the compositor doesn't ignore those links when computing the reference counts for outputs. To fix this, check if the output is logically linked and return 0 in case it isn't. --- .../compositor/realtime_compositor/intern/utilities.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/blender/compositor/realtime_compositor/intern/utilities.cc b/source/blender/compositor/realtime_compositor/intern/utilities.cc index 8be2e10a4c5..5d6dc116d51 100644 --- a/source/blender/compositor/realtime_compositor/intern/utilities.cc +++ b/source/blender/compositor/realtime_compositor/intern/utilities.cc @@ -84,6 +84,10 @@ bool is_output_linked_to_node_conditioned(DOutputSocket output, FunctionRef condition) { + if (!output->is_logically_linked()) { + return 0; + } + int count = 0; output.foreach_target_socket( [&](DInputSocket target, const TargetSocketPathInfo & /*path_info*/) {