From 415b5b82cae5949c65ff756519d27f602c6ff50c Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@vt.edu>
Date: Wed, 10 Sep 2014 11:21:42 -0400
Subject: [PATCH] *fixed bug with preset_node status being corrupt with the
 status outlet

---
 pd/src/g_editor.c | 6 +++++-
 pd/src/x_preset.c | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c
index a2376d563..dafc0b290 100644
--- a/pd/src/g_editor.c
+++ b/pd/src/g_editor.c
@@ -3805,7 +3805,7 @@ int canvas_doconnect_doit(t_canvas *x, t_gobj *y1, t_gobj *y2,
             error("preset_node does not work with messages.");
             return(1);
         }
-        if (obj_noutlets(ob2) == 0)
+        if (obj_noutlets(ob2) == 0 && pd_class(&y2->g_pd) != print_class)
         {
             error("preset_node does not work with objects with zero "
                   "or undefined number of outlets\n");
@@ -3880,7 +3880,11 @@ int canvas_doconnect_doit(t_canvas *x, t_gobj *y1, t_gobj *y2,
     {
         
         //fprintf(stderr,"gotta do auto-connect back to preset_node\n");
+        // second check is to make sure we are not connected to the
+        // second outlet of the preset_node in which case we should not
+        // connect back to it
         if (!canvas_isconnected(x, ob2, 0, ob1, 0) &&
+            !canvas_isconnected(x, ob1, 1, ob2, 0) &&
             pd_class(&y2->g_pd) != print_class)
         {
             oc2 = obj_connect(ob2, 0, ob1, 0);
diff --git a/pd/src/x_preset.c b/pd/src/x_preset.c
index 3e73ba49f..31c5cd26c 100644
--- a/pd/src/x_preset.c
+++ b/pd/src/x_preset.c
@@ -529,7 +529,7 @@ static int preset_node_location_changed(t_preset_node *x)
 
 static void preset_node_anything(t_preset_node *x, t_symbol *s, int argc, t_atom *argv)
 {
-    if (PH_DEBUG) fprintf(stderr,"preset_node_anything %lx\n", (t_int)x);
+    if (PH_DEBUG) fprintf(stderr,"preset_node_anything %lx %s %d\n", (t_int)x, s->s_name, argc);
     int i;
     alist_list(&x->pn_val, 0, argc, argv);
     if (PH_DEBUG)
-- 
GitLab