[PD-dev] [ pure-data-Patches-1990592 ] prevent multiple registration of loaders

SourceForge.net noreply at sourceforge.net
Fri Jul 30 04:31:27 CEST 2010


Patches item #1990592, was opened at 2008-06-11 04:30
Message generated for change (Comment added) made by eighthave
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478072&aid=1990592&group_id=55736

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: puredata
Group: None
Status: Closed
Resolution: Accepted
Priority: 5
Private: No
Submitted By: IOhannes m zmlnig (zmoelnig)
Assigned to: Miller Puckette (millerpuckette)
Summary: prevent multiple registration of loaders

Initial Comment:
if a single loader is registered multiple times with sys_register_loader(), it will be inserted multiple times in the loader-chain.
thus it might be called several times when a new object is instantiated.

i guess this could be considered a feature, but i was not able to think of any application that would need such a feature.
otoh i stumbled across it, as a (rather naive) implementation of a new loader registered itself permanently, resulting in a very long list of identical loaders to be executed
(yes, the bug was in my loader code, but still i think it rather weird that a loader can be registered several times)

so here is a tiny patch that will prevent already registered loaders to be added to the list of loaders.

--- s_loader.c  (Revision 9979)
+++ s_loader.c  (Arbeitskopie)
@@ -218,6 +218,9 @@
     loader_queue_t *q = &loaders;
     while (1)
     {
+        /* prevent loaders from being registered multiple times */
+        if (q->loader == loader) return;
+
         if (q->next)
             q = q->next;
         else


----------------------------------------------------------------------

>Comment By: Hans-Christoph Steiner (eighthave)
Date: 2010-07-29 22:31

Message:
git commit f5a2e9e3574287a7058ff5368ac93dc11b2a3376

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478072&aid=1990592&group_id=55736



More information about the Pd-dev mailing list