A couple of fixes for drag-and-dropped plugins


#1

I just came across a couple of easily-fixed issues while bughunting for my plugin host:

PluginListComponent is missing a public FileDragAndDropTarget declaration. The filesDropped() methods are implemented, but they’re obviously not going to get called if it’s not actually inheriting from FileDragAndDropTarget.

I think line 142 of juce_KnownPluginList.cpp should be rewritten something like the following:

Without that format check, if the user drags a plugin that’s already in the list of known plugins, and there’s more than one known format, the method creates multiple instances of the plugin, one for every format that AudioPluginFormatManager knows about (because scanAndAddFile() is getting called from a loop in scanAndAddDragAndDroppedFiles() ).

(I’m using the modules branch, btw)


#2

Excellent stuff, thanks Niall!


#3

On a related note: in KnownPluginList::scanAndAddFile, the current version has the section

for (int i = 0; i < found.size(); ++i)
    {
        PluginDescription* const desc = found.getUnchecked(i);
        jassert (desc != nullptr);

        if (addType (*desc))
            addedOne = true;
			typesFound.add (new PluginDescription (*desc));
    }

Shouldn’t that be

for (int i = 0; i < found.size(); ++i)
    {
        PluginDescription* const desc = found.getUnchecked(i);
        jassert (desc != nullptr);

        if (addType (*desc))
		{//put brackets here
         addedOne = true;
			typesFound.add (new PluginDescription (*desc));
		}
    }

? Otherwise I still get two instances for each plugin when draggin-and-a-droppin…


#4

…yes, I think you might be right there, thanks!