From dc890c69c2670c4edf45529d85be53c8b5500bd0 Mon Sep 17 00:00:00 2001 From: reuk Date: Tue, 3 Jun 2025 17:40:12 +0100 Subject: [PATCH] PluginListComponent: Use lambda form of ModalCallbackFunction --- .../scanning/juce_PluginListComponent.cpp | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/modules/juce_audio_processors/scanning/juce_PluginListComponent.cpp b/modules/juce_audio_processors/scanning/juce_PluginListComponent.cpp index 28f84c9e96..81cdcfce47 100644 --- a/modules/juce_audio_processors/scanning/juce_PluginListComponent.cpp +++ b/modules/juce_audio_processors/scanning/juce_PluginListComponent.cpp @@ -194,9 +194,13 @@ public: pathChooserWindow.addButton (TRANS ("Cancel"), 0, KeyPress (KeyPress::escapeKey)); pathChooserWindow.enterModalState (true, - ModalCallbackFunction::forComponent (startScanCallback, - &pathChooserWindow, this), - false); + ModalCallbackFunction::create ([this] (auto result) + { + if (result != 0) + warnUserAboutStupidPaths(); + else + finishedScan(); + })); } else { @@ -230,17 +234,6 @@ private: std::set initiallyBlacklistedFiles; ScopedMessageBox messageBox; - static void startScanCallback (int result, AlertWindow* alert, Scanner* scanner) - { - if (alert != nullptr && scanner != nullptr) - { - if (result != 0) - scanner->warnUserAboutStupidPaths(); - else - scanner->finishedScan(); - } - } - // Try to dissuade people from to scanning their entire C: drive, or other system folders. void warnUserAboutStupidPaths() {