aboutsummaryrefslogtreecommitdiff
path: root/packages/patches/allow_recursive_calls_of_new_anything-0.41.4.patch
blob: d2ea86e2cf5199ae5299077ae0b948620fbe611c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Index: m_class.c
===================================================================
--- m_class.c	(Revision 9979)
+++ m_class.c	(Arbeitskopie)
@@ -522,6 +522,7 @@
     return (gensym(namebuf));
 }
 
+#define MAXOBJDEPTH 1000
 static int tryingalready;
 
 void canvas_popabstraction(t_canvas *x);
@@ -537,14 +538,17 @@
     t_pd *current;
     int fd;
     char dirbuf[MAXPDSTRING], *nameptr;
-    if (tryingalready) return;
+    if (tryingalready>MAXOBJDEPTH){
+      error("maximum object loading depth %d reached", MAXOBJDEPTH);
+      return;
+    }
     newest = 0;
     class_loadsym = s;
     if (sys_load_lib(canvas_getcurrent(), s->s_name))
     {
-        tryingalready = 1;
+        tryingalready++;
         typedmess(dummy, s, argc, argv);
-        tryingalready = 0;
+        tryingalready--;
         return;
     }
     class_loadsym = 0;