From 04f41b670d9d33a0a9ab0e690fda08a9dfdc8ca8 Mon Sep 17 00:00:00 2001 From: Sebastian Kraft Date: Wed, 7 Dec 2022 13:49:59 +0100 Subject: [PATCH] Ignore empty unique ID when checking for juce::PluginDescription duplicates --- .../processors/juce_PluginDescription.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/modules/juce_audio_processors/processors/juce_PluginDescription.cpp b/modules/juce_audio_processors/processors/juce_PluginDescription.cpp index 470ff9d9e5..2f8eed0a5e 100644 --- a/modules/juce_audio_processors/processors/juce_PluginDescription.cpp +++ b/modules/juce_audio_processors/processors/juce_PluginDescription.cpp @@ -28,12 +28,21 @@ namespace juce bool PluginDescription::isDuplicateOf (const PluginDescription& other) const noexcept { - const auto tie = [] (const PluginDescription& d) + if ((other.fileOrIdentifier == fileOrIdentifier) && + (other.deprecatedUid == deprecatedUid)) { - return std::tie (d.fileOrIdentifier, d.deprecatedUid, d.uniqueId); - }; + // Only compare uniqueId field if it is set in both descriptions + if ((other.uniqueId > 0) && (uniqueId > 0)) + { + return (other.uniqueId == uniqueId); + } + else + { + return true; + } + } - return tie (*this) == tie (other); + return false; } static String getPluginDescSuffix (const PluginDescription& d, int uid)