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

SourceForge.net noreply at sourceforge.net
Wed Jun 11 10:30:10 CEST 2008


Patches item #1990592, was opened at 2008-06-11 10:30
Message generated for change (Tracker Item Submitted) made by Item Submitter
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: Open
Resolution: None
Priority: 5
Private: No
Submitted By: IOhannes m zmölnig (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


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

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