From 6c726f078b938fda33da4cc6ec9c554eba2b42dd Mon Sep 17 00:00:00 2001
From: Albert Graef <aggraef@gmail.com>
Date: Wed, 2 Oct 2024 11:57:27 +0200
Subject: [PATCH] Fix crash bug in signal_makereusable.

---
 pd/src/d_ugen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pd/src/d_ugen.c b/pd/src/d_ugen.c
index a9259afc0..f5c3c3117 100644
--- a/pd/src/d_ugen.c
+++ b/pd/src/d_ugen.c
@@ -433,7 +433,7 @@ void signal_makereusable(t_signal *sig)
     if (ugen_loud) post("free %zx: %d", sig, sig->s_isborrowed);
     if (sig->s_isborrowed || sig->s_isscalar)
     {
-        if (sig->s_isborrowed)
+        if (sig->s_isborrowed && sig->s_borrowedfrom)
         {
             /* if the signal is borrowed, decrement the borrowed-from signal's
                 reference count, possibly marking it reusable too */
-- 
GitLab