Skip to content

Commit

Permalink
Fixing lifetimes bug in PresetManager::loadPreset()
Browse files Browse the repository at this point in the history
  • Loading branch information
jatinchowdhury18 committed Apr 11, 2024
1 parent 87d75fa commit c66e7a4
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,19 +135,24 @@ void PresetManager::loadUserPresetsFromFolder (const juce::File& file)

void PresetManager::loadPreset (const Preset& preset)
{
#if HAS_CLAP_JUCE_EXTENSIONS
const auto presetFile = preset.getPresetFile();
const auto presetName = preset.getName();
#endif

saverLoader.loadPreset (preset);

#if HAS_CLAP_JUCE_EXTENSIONS
if (preset.getPresetFile() == juce::File {})
if (presetFile == juce::File {})
{
clapPresetLoadedBroadcaster (CLAP_PRESET_DISCOVERY_LOCATION_PLUGIN,
nullptr,
preset.getName().toRawUTF8());
presetName.toRawUTF8());
}
else
{
clapPresetLoadedBroadcaster (CLAP_PRESET_DISCOVERY_LOCATION_FILE,
preset.getPresetFile().getFullPathName().toRawUTF8(),
presetFile.getFullPathName().toRawUTF8(),
nullptr);
}
#endif
Expand Down

0 comments on commit c66e7a4

Please sign in to comment.