Просмотр исходного кода

File > Export > DAWproject and Save a copy as FLM: the chooser opens again (it died at once in 0.1.31.x)

Discord norenkae 11-28: "export to DAWproject does nothing in lynx". showDawProjectExport made its file chooser as a
local std::shared_ptr and launched it through ui::launchChooser's shared_ptr form, whose contract is that the callback
keeps the chooser alive; the callback captured only the engine and the parent. The chooser was destroyed when the menu
action returned (JUCE's ~FileChooser drops the callback, its dialog goes with it), so the menu item did nothing: no
dialog, no file, no message, on Linux and Windows. "Save a copy as FL Studio Mobile project (.flm)..." had the same
fault after its losses window. Both callbacks now capture the chooser. The writers were fine (the selftests called them
directly, which is why nothing saw it).

The rest of launchChooser's 114 calls were checked: every other chooser is a member, a function-static or captured.

New check (src/MenuWindows190skCheck.inc; --selftest "menuwindows190sk", --menuwindows190sktest <report>): drives the
real File menu (MainComponent::menuForCheck -> getMenuForIndex, the items' own actions) with the built-in chooser:
every "..." item of File, New from template, Open in new window, Import and Export (32) opens its window and closes
again; FLM, Export to FL Studio, the Live set and Save a copy for an older LYNX reach their chooser; DAWproject and FLM
are written end to end through the menu (zip with project.xml + metadata.xml, the report window). Without the fix it
fails on exactly the two items. On Windows it runs on CI or with LYNX_MENUSWEEP=1 (its windows show on the desktop).
Ka1-S 1 неделя назад
Родитель
Сommit
21cb02590c
5 измененных файлов с 347 добавлено и 3 удалено
  1. 18 1
      src/Main.cpp
  2. 321 0
      src/MenuWindows190skCheck.inc
  3. 4 1
      src/ui/DawProjectExport.cpp
  4. 2 1
      src/ui/FlmExportDialog.cpp
  5. 2 0
      src/ui/MainComponent.h

+ 18 - 1
src/Main.cpp

@@ -2313,6 +2313,17 @@ public:
             quit();
             return;
         }
+        if (args.contains ("--menuwindows190sktest"))
+        {
+            // LYNX --menuwindows190sktest report.txt (round 190sk, every File-menu "..." item opens its window, DAWproject /
+            // FLM written through the menu; also in --selftest): src/MenuWindows190skCheck.inc
+            juce::String log;
+            const auto result = menuWindows190skCheck (log);
+            juce::File (args[args.indexOf ("--menuwindows190sktest") + 1].unquoted()).replaceWithText (log + "menuwindows190sk=" + result + "\n");
+            setApplicationReturnValue (result == "OK" ? 0 : 1);
+            quit();
+            return;
+        }
         if (args.contains ("--perf190sbtest"))
         {
             // LYNX --perf190sbtest report.txt (round 190sb, FL's plugin database kept between starts; also in --selftest): src/Perf190sbCheck.inc
@@ -10647,6 +10658,10 @@ private:
         // round 190sb (stage Q2): FL's plugin database kept between starts (src/Perf190sbCheck.inc)
         juce::String perf190sbLog;
         const auto perf190sbResult = perf190sbCheck (perf190sbLog);
+        // round 190sk (Discord norenkae: "export to DAWproject does nothing"): the File menu's "..." items open their windows
+        // through the real menu; DAWproject and FLM written through it (src/MenuWindows190skCheck.inc)
+        juce::String menuwindows190skLog;
+        const auto menuwindows190skResult = menuWindows190skCheck (menuwindows190skLog);
 
         // round 190rb (0.1.32 quality release): the crash / memory fixes of the crash reports, the sanitizer build and the
         // UI monkey test (src/Qa190rbCheck.inc)
@@ -12088,7 +12103,7 @@ private:
                         && sidechainResult == "OK" && lanesResult == "OK" && arrange190cgResult == "OK" && livescr190drResult == "OK" && livewf190efResult == "OK" && livewf190emResult == "OK" && trackclips190neResult == "OK" && tracker190nwResult == "OK" && tracker190obResult == "OK" && rackauto190ooResult == "OK" && tracker190omResult == "OK" && rackauto190owResult == "OK" && versionsResult == "OK" && pluginsOffResult == "OK" && missingFilesResult == "OK"
                         && midigen190fmResult == "OK" && clipenv190giResult == "OK" && beatslaw190gxResult == "OK" && warplaw190ikResult == "OK" && editorScale190heResult == "OK" && sfModBase190heResult == "OK" && trackauto190gzResult == "OK" && community190hqResult == "OK" && rollup030Result == "OK" && rollup031Result == "OK" && rollup031s2Result == "OK"
                         && keys190nuResult == "OK" && rollup031s3Result == "OK"
-                        && helix4khs190ocResult == "OK" && rollup031s4Result == "OK" && sections190olResult == "OK" && rollup031s5Result == "OK" && simpleDuck190otResult == "OK" && tracks190peResult == "OK" && issue258Result == "OK" && issues190qrResult == "OK" && backlog190rcResult == "OK" && community190riResult == "OK" && q1a190rwResult == "OK" && iox190rmResult == "OK" && issues190rtResult == "OK" && perf190rnResult == "OK" && perf190sbResult == "OK" && qa190rbResult == "OK" && bugs190rvResult == "OK" && q6190saResult == "OK" && issue325Result == "OK" && keysheet190sjResult == "OK" && stab190rpResult == "OK" && repeats190pmResult == "OK" && mixerqol190qhResult == "OK" && autolive190qpResult == "OK" && issue282Result == "OK" && feel190qeResult == "OK" && toolbar190qgResult == "OK" && extras190qkResult == "OK" && extras190roResult == "OK" && discord190quResult == "OK" && trialmark190qtResult == "OK" && optionsux190qxResult == "OK" && chordlane190pfResult == "OK" && autolinks190ovResult == "OK"
+                        && helix4khs190ocResult == "OK" && rollup031s4Result == "OK" && sections190olResult == "OK" && rollup031s5Result == "OK" && simpleDuck190otResult == "OK" && tracks190peResult == "OK" && issue258Result == "OK" && issues190qrResult == "OK" && backlog190rcResult == "OK" && community190riResult == "OK" && q1a190rwResult == "OK" && iox190rmResult == "OK" && issues190rtResult == "OK" && perf190rnResult == "OK" && perf190sbResult == "OK" && menuwindows190skResult == "OK" && qa190rbResult == "OK" && bugs190rvResult == "OK" && q6190saResult == "OK" && issue325Result == "OK" && keysheet190sjResult == "OK" && stab190rpResult == "OK" && repeats190pmResult == "OK" && mixerqol190qhResult == "OK" && autolive190qpResult == "OK" && issue282Result == "OK" && feel190qeResult == "OK" && toolbar190qgResult == "OK" && extras190qkResult == "OK" && extras190roResult == "OK" && discord190quResult == "OK" && trialmark190qtResult == "OK" && optionsux190qxResult == "OK" && chordlane190pfResult == "OK" && autolinks190ovResult == "OK"
                         && trackstates190opResult == "OK" && rollup031s6Result == "OK" // (round 190op's item, reported but not counted in its branch: rollup 0.1.31 step 6)
                         && rollup031s7Result == "OK" && rollup031s8Result == "OK" && rollup032Result == "OK" && headerGearResult == "OK" && perTab259Result == "OK" && slots260Result == "OK" && hotfixPlacesResult == "OK" && startPageScrollResult.startsWith ("OK") // (round 190qf: slots260) (rollup 0.1.31 step 7, round 190pw; and the three rounds' items its branches reported but did not count:)
                         && slides190piResult == "OK" && automodes190paResult == "OK" && heldSteps190ozResult == "OK"
@@ -12220,6 +12235,7 @@ private:
                << "issues190rt=" << issues190rtResult << "\n" << issues190rtLog
                << "perf190rn=" << perf190rnResult << "\n"
                << "perf190sb=" << perf190sbResult << (perf190sbResult == "OK" ? juce::String() : " | " + perf190sbLog.replace ("\n", "; ")) << "\n"
+               << "menuwindows190sk=" << menuwindows190skResult << (menuwindows190skResult == "OK" ? juce::String() : " | " + menuwindows190skLog.replace ("\n", "; ")) << "\n"
                << "qa190rb=" << qa190rbResult << "\n"
                << "bugs190rv=" << bugs190rvResult << (bugs190rvResult == "OK" ? juce::String() : " | " + bugs190rvLog.replace ("\n", "; ")) << "\n"
                << "q6190sa=" << q6190saResult << (q6190saResult == "OK" ? juce::String() : " | " + q6190saLog.replace ("\n", "; ")) << "\n"
@@ -22654,6 +22670,7 @@ private:
 #include "Community190riCheck.inc" // round 190ri: the 0.1.32 community batch
 #include "Perf190rnCheck.inc" // round 190rn: the undo history's memory cap
 #include "Perf190sbCheck.inc" // round 190sb: FL's plugin database kept between starts
+#include "MenuWindows190skCheck.inc" // round 190sk: the File menu's "..." items open their windows (DAWproject export did nothing)
 #include "Backlog190rcCheck.inc" // round 190rc: #288 native presets, #287 MIDI drop, #283 #285 #286, PR #284, Discord 11-24
 #include "Bugs190rvCheck.inc" // round 190rv: 0.1.32 open bug issues (#317 header LED, #319 pin)
 #include "Q6Check190sa.inc" // round 190sa: 0.1.32 Q6 (files) + the Simple layout's sound drop

+ 321 - 0
src/MenuWindows190skCheck.inc

@@ -0,0 +1,321 @@
+    // Round 190sk (Discord norenkae 11-28: "export to DAWproject does nothing in lynx"): File › Export › "DAWproject
+    // (.dawproject)..." opened nothing in 0.1.31.x and the 0.1.32 rollup: its chooser was a local std::shared_ptr its own
+    // callback did not keep, so it died (and its dialog with it) when the menu action returned. "Save a copy as FL Studio
+    // Mobile project (.flm)..." had the same fault behind its first window. The selftests wrote both files without the
+    // menu, so nothing saw it. This check drives the real menu (MainComponent::getMenuForIndex, the items' own actions)
+    // with JUCE's built-in chooser (LYNX_FILE_DIALOG=builtin):
+    //  1. every item of File, File › New from template, Open in new window, Import and Export whose name ends in "..."
+    //     (FL's sign for "opens a window") opens one: a modal component, a window on the desktop or a panel in the main
+    //     window that was not there before, still there after the message loop ran; then it is cancelled;
+    //  2. the export items whose first window leads to a chooser (FLM's losses window, Export to FL Studio, Ableton Live
+    //     set, Save a copy for an older LYNX) reach their chooser;
+    //  3. DAWproject end to end: the menu item, the chooser given a file name, the file written on the worker (a zip with
+    //     project.xml and metadata.xml) and the report window; FLM the same way.
+    // Included in the app class of Main.cpp; --menuwindows190sktest <report> and --selftest "menuwindows190sk". The windows
+    // show on the desktop for a moment: on Windows it runs only on CI or with LYNX_MENUSWEEP=1 (the owner's screen).
+    juce::String menuWindows190skCheck (juce::String& log)
+    {
+        using namespace lynx;
+        juce::String result = "OK";
+        const auto check = [&] (const juce::String& what, bool ok, const juce::String& detail = {}) {
+            log << (ok ? "ok   " : "FAIL ") << what << (detail.isNotEmpty() ? " (" + detail + ")" : juce::String()) << "\n";
+            if (! ok && result == "OK")
+                result = "ERROR " + what;
+        };
+#if JUCE_MAC
+        log << "skipped on macOS (the selftest has no message pump there)\n";
+        return result;
+#else
+ #if JUCE_WINDOWS
+        if (juce::SystemStats::getEnvironmentVariable ("CI", {}).isEmpty() && juce::SystemStats::getEnvironmentVariable ("GITHUB_ACTIONS", {}).isEmpty()
+            && juce::SystemStats::getEnvironmentVariable ("LYNX_MENUSWEEP", {}) != "1")
+        {
+            log << "skipped on this Windows desktop (windows would show on the owner's screen): LYNX_MENUSWEEP=1 runs it\n";
+            return result;
+        }
+ #endif
+        const auto setEnv = [] (const char* name, const juce::String& value) {
+ #if JUCE_WINDOWS
+            _putenv_s (name, value.toRawUTF8());
+ #else
+            if (value.isEmpty())
+                unsetenv (name);
+            else
+                setenv (name, value.toRawUTF8(), 1);
+ #endif
+        };
+        const auto oldDialog = juce::SystemStats::getEnvironmentVariable ("LYNX_FILE_DIALOG", {});
+        setEnv ("LYNX_FILE_DIALOG", "builtin");
+
+        const auto root = juce::File::getSpecialLocation (juce::File::tempDirectory).getChildFile ("lynx-menu190sk-" + juce::String (juce::Random::getSystemRandom().nextInt64()));
+        root.createDirectory();
+        {
+            AudioEngine offline (false);
+            MainComponent ui (offline, false);
+            ui.setSize (1600, 900);
+            ui.setVisible (true);
+            const auto settle = [&offline] {
+                for (int k = 0; k < 4; ++k)
+                    offline.dispatchPendingMessages();
+                for (int i = 0; i < 256 && juce::detail::dispatchNextMessageOnSystemQueue (true); ++i) {}
+            };
+            const auto pump = [&settle] (int ms) {
+                const auto end = juce::Time::getMillisecondCounter() + (juce::uint32) ms;
+                while (juce::Time::getMillisecondCounter() < end)
+                {
+                    settle();
+                    juce::Thread::sleep (10);
+                }
+            };
+            // a short song: a pattern of four notes on the first channel, once on the playlist
+            offline.editSong ([] (Song& s) {
+                if (s.channels.empty())
+                    return;
+                Pattern p;
+                p.name = "Pattern 1";
+                for (int i = 0; i < 4; ++i)
+                {
+                    Note n;
+                    n.channel = 0;
+                    n.key = 60 + i * 2;
+                    n.start = i * ppq;
+                    n.length = ppq / 2;
+                    p.notes.push_back (n);
+                }
+                s.patterns = { p };
+                Clip c;
+                c.kind = ClipKind::pattern;
+                c.pattern = 0;
+                c.track = 0;
+                c.start = 0;
+                c.length = 4 * ppq;
+                s.playlist = { c };
+                s.mode = PlayMode::song;
+            });
+            pump (300);
+
+            auto* modal = juce::ModalComponentManager::getInstance();
+            const auto desktop = [] {
+                std::set<juce::Component*> s;
+                auto& d = juce::Desktop::getInstance();
+                for (int i = 0; i < d.getNumComponents(); ++i)
+                    if (auto* c = d.getComponent (i); c != nullptr && c->isVisible())
+                        s.insert (c);
+                return s;
+            };
+            const auto panels = [&ui] {
+                std::set<juce::Component*> s;
+                for (auto* c : ui.getChildren())
+                    if (c->isVisible() && c->getWidth() >= 120 && c->getHeight() >= 60)
+                        s.insert (c);
+                return s;
+            };
+            const auto nameOf = [] (juce::Component* c) {
+                if (auto* w = dynamic_cast<juce::TopLevelWindow*> (c); w != nullptr && w->getName().isNotEmpty())
+                    return w->getName();
+                return c->getName().isNotEmpty() ? c->getName() : juce::String ("unnamed");
+            };
+            std::function<juce::Component* (juce::Component*, const std::function<bool (juce::Component*)>&)> find;
+            find = [&find] (juce::Component* in, const std::function<bool (juce::Component*)>& pred) -> juce::Component* {
+                if (in == nullptr)
+                    return nullptr;
+                if (pred (in))
+                    return in;
+                for (auto* c : in->getChildren())
+                    if (auto* f = find (c, pred))
+                        return f;
+                return nullptr;
+            };
+            const auto chooserBox = [modal]() -> juce::FileChooserDialogBox* {
+                for (int i = 0; i < modal->getNumModalComponents(); ++i)
+                    if (auto* b = dynamic_cast<juce::FileChooserDialogBox*> (modal->getModalComponent (i)); b != nullptr && b->isVisible())
+                        return b;
+                return nullptr;
+            };
+            const auto baseModal = modal->getNumModalComponents();
+            const auto baseDesktop = desktop();
+            const auto basePanels = panels();
+            // closes whatever the item opened: Cancel (result 0) on every modal window, the close button of new windows,
+            // new panels of the main window hidden
+            const auto closeAll = [&] {
+                for (int round = 0; round < 6; ++round)
+                {
+                    modal->cancelAllModalComponents();
+                    pump (120);
+                    for (auto* c : desktop())
+                        if (baseDesktop.count (c) == 0)
+                        {
+                            if (auto* w = dynamic_cast<juce::DocumentWindow*> (c))
+                                w->closeButtonPressed();
+                            else
+                                c->setVisible (false);
+                        }
+                    for (auto* c : panels())
+                        if (basePanels.count (c) == 0)
+                            c->setVisible (false);
+                    pump (80);
+                    if (modal->getNumModalComponents() <= baseModal && desktop().size() <= baseDesktop.size())
+                        return true;
+                }
+                return false;
+            };
+            // what opened since the baseline ("" = nothing)
+            const auto opened = [&]() -> juce::String {
+                juce::StringArray what;
+                if (modal->getNumModalComponents() > baseModal)
+                    for (int i = 0; i < modal->getNumModalComponents() - baseModal; ++i)
+                        if (auto* c = modal->getModalComponent (i))
+                            what.add ("modal " + nameOf (c));
+                for (auto* c : desktop())
+                    if (baseDesktop.count (c) == 0)
+                        what.addIfNotAlreadyThere ("window " + nameOf (c));
+                for (auto* c : panels())
+                    if (basePanels.count (c) == 0)
+                        what.add ("panel " + nameOf (c));
+                return what.joinIntoString (", ");
+            };
+
+            // the menu's items: (path, action) for every "..." item of the submenus named here
+            struct Entry
+            {
+                juce::String path;
+                std::function<void()> action;
+            };
+            const auto bare = [] (const juce::String& text) { return text.upToFirstOccurrenceOf ("\t", false, false).trim(); };
+            const auto collect = [&] {
+                std::vector<Entry> out;
+                const auto menu = ui.menuForCheck (0, "File");
+                const juce::StringArray walk { "New from template", "Open in new window", "Import", "Export" };
+                std::function<void (const juce::PopupMenu&, const juce::String&)> add = [&] (const juce::PopupMenu& m, const juce::String& prefix) {
+                    for (juce::PopupMenu::MenuItemIterator it (m); it.next();)
+                    {
+                        const auto& item = it.getItem();
+                        const auto text = bare (item.text);
+                        if (item.subMenu != nullptr)
+                        {
+                            if (walk.contains (text))
+                                add (*item.subMenu, prefix + text + " > ");
+                            continue;
+                        }
+                        if (item.isEnabled && item.action && (text.endsWith ("...") || text.endsWith (juce::String::fromUTF8 ("\xe2\x80\xa6"))))
+                            out.push_back ({ prefix + text, item.action });
+                    }
+                };
+                add (menu, "File > ");
+                return out;
+            };
+            const auto entries = collect();
+            check ("the File menu lists its '...' items", entries.size() >= 25, juce::String ((int) entries.size()));
+            for (const auto* must : { "File > Export > DAWproject (.dawproject)...", "File > Save a copy as FL Studio Mobile project (.flm)...",
+                                      "File > Export > Ableton Live set (.als)...", "File > Export > FL Studio project...", "File > Export > Wave file...",
+                                      "File > Open...", "File > Save as..." })
+                check (juce::String ("listed: ") + must, std::any_of (entries.begin(), entries.end(), [must] (const Entry& e) { return e.path == must; }));
+
+            // 1. every "..." item opens its window, and it is still open after the message loop ran
+            // (the song counts as saved: "New project..." and "Open..." then open their own window, not "save changes?")
+            for (const auto& e : entries)
+            {
+                offline.markSaved();
+                e.action();
+                pump (250);
+                const auto what = opened();
+                check ("opens its window: " + e.path, what.isNotEmpty(), what);
+                check ("and it closes again: " + e.path, closeAll());
+            }
+
+            // 2. the items whose first window leads to a chooser reach it (Export... / OK)
+            const auto byPath = [&entries] (const juce::String& path) -> std::function<void()> {
+                for (const auto& e : entries)
+                    if (e.path == path)
+                        return e.action;
+                return {};
+            };
+            for (const auto* path : { "File > Save a copy as FL Studio Mobile project (.flm)...", "File > Export > FL Studio project...",
+                                      "File > Export > Ableton Live set (.als)...", "File > Save a copy for an older LYNX..." })
+            {
+                const auto action = byPath (path);
+                if (! action)
+                    continue;
+                action();
+                pump (250);
+                juce::Component* first = modal->getNumModalComponents() > baseModal ? modal->getModalComponent (0) : nullptr;
+                auto* exportButton = dynamic_cast<juce::Button*> (find (first, [] (juce::Component* c) {
+                    auto* b = dynamic_cast<juce::TextButton*> (c);
+                    return b != nullptr && b->isEnabled() && b->getButtonText().startsWith ("Export");
+                }));
+                if (exportButton != nullptr)
+                    exportButton->triggerClick();
+                else if (first != nullptr)
+                    first->exitModalState (1); // (an AlertWindow: its OK / Save button)
+                pump (300);
+                check (juce::String ("reaches its chooser: ") + path, chooserBox() != nullptr, opened());
+                closeAll();
+            }
+
+            // 3. end to end through the menu: the chooser given a name, the file written, the report shown
+            const auto throughChooser = [&] (const juce::String& path, const juce::String& fileName, bool alertFirst, const juce::String& reportTitle) -> juce::File {
+                const auto action = byPath (path);
+                if (! action)
+                    return {};
+                action();
+                pump (250);
+                if (alertFirst && modal->getNumModalComponents() > baseModal)
+                {
+                    modal->getModalComponent (0)->exitModalState (1);
+                    pump (250);
+                }
+                auto* box = chooserBox();
+                check ("the chooser is open: " + path, box != nullptr, opened());
+                auto* browser = dynamic_cast<juce::FileBrowserComponent*> (find (box, [] (juce::Component* c) { return dynamic_cast<juce::FileBrowserComponent*> (c) != nullptr; }));
+                if (box == nullptr || browser == nullptr)
+                {
+                    closeAll();
+                    return {};
+                }
+                browser->setRoot (root);
+                browser->setFileName (fileName);
+                pump (100);
+                box->exitModalState (1); // (the chooser's Save button)
+                const auto target = root.getChildFile (fileName);
+                const auto end = juce::Time::getMillisecondCounter() + 60000u;
+                // done: the file is there and nothing is still being written (DAWproject: its report window, "Export
+                // DAWproject"; FLM: the saved-file hint, no window)
+                bool done = false;
+                juce::String report;
+                while (juce::Time::getMillisecondCounter() < end && ! done)
+                {
+                    pump (100);
+                    for (int i = 0; i < modal->getNumModalComponents(); ++i)
+                        if (auto* a = dynamic_cast<juce::AlertWindow*> (modal->getModalComponent (i)))
+                            report = a->getName();
+                    done = target.existsAsFile() && (reportTitle.isEmpty() || report == reportTitle);
+                }
+                check ("done through the menu: " + path, done, report.isNotEmpty() ? "report window: " + report : opened());
+                closeAll();
+                return target;
+            };
+            const auto daw = throughChooser ("File > Export > DAWproject (.dawproject)...", "menu190sk.dawproject", false, tr ("Export DAWproject"));
+            bool zipOk = false;
+            if (daw.existsAsFile())
+            {
+                juce::ZipFile zip (daw);
+                zipOk = zip.getIndexOfFileName ("project.xml") >= 0 && zip.getIndexOfFileName ("metadata.xml") >= 0;
+                if (zipOk)
+                {
+                    std::unique_ptr<juce::InputStream> in (zip.createStreamForEntry (zip.getIndexOfFileName ("project.xml")));
+                    const auto xml = in != nullptr ? in->readEntireStreamAsString() : juce::String();
+                    zipOk = xml.contains ("<Project") && xml.contains ("<Notes") && xml.contains ("<Note ");
+                }
+            }
+            check ("File > Export > DAWproject writes the file through the menu (a zip: project.xml with the notes, metadata.xml)", zipOk,
+                   daw.getFullPathName() + (daw.existsAsFile() ? " " + juce::String (daw.getSize()) + " bytes" : " missing"));
+            const auto flm = throughChooser ("File > Save a copy as FL Studio Mobile project (.flm)...", "menu190sk.flm", true, {});
+            check ("File > Save a copy as FL Studio Mobile project writes the file through the menu", flm.existsAsFile() && flm.getSize() > 0,
+                   flm.getFullPathName());
+            closeAll();
+        }
+        root.deleteRecursively();
+        setEnv ("LYNX_FILE_DIALOG", oldDialog);
+        return result;
+#endif
+    }

+ 4 - 1
src/ui/DawProjectExport.cpp

@@ -268,7 +268,10 @@ void showDawProjectExport (AudioEngine& engine, juce::Component* parent, const j
     auto chooser = std::shared_ptr<juce::FileChooser> (
         ui::makeFileChooser (tr ("Export DAWproject"), suggestedFolder.getChildFile (stem + ".dawproject"), "*.dawproject").release());
     ui::launchChooser (chooser, juce::FileBrowserComponent::saveMode | juce::FileBrowserComponent::warnAboutOverwriting,
-                       [&engine, safe = juce::Component::SafePointer<juce::Component> (parent)] (const juce::FileChooser& c) {
+                       // (round 190sk, Discord norenkae 11-28: "export to DAWproject does nothing") the callback keeps the
+                       // chooser: launchChooser's shared_ptr form relies on that. Without it the chooser died when this
+                       // function returned, its dialog with it, and the export never ran (0.1.31.x).
+                       [&engine, chooser, safe = juce::Component::SafePointer<juce::Component> (parent)] (const juce::FileChooser& c) {
                            auto target = c.getResult();
                            if (target == juce::File())
                                return;

+ 2 - 1
src/ui/FlmExportDialog.cpp

@@ -129,7 +129,8 @@ void showFlmExportDialog (AudioEngine& engine, juce::Component* parent, const ju
         auto chooser = std::shared_ptr<juce::FileChooser> (
             ui::makeFileChooser (tr ("Save a copy as FL Studio Mobile project"), suggestedFolder.getChildFile (stem + ".flm"), "*.flm").release());
         ui::launchChooser (chooser, juce::FileBrowserComponent::saveMode | juce::FileBrowserComponent::warnAboutOverwriting,
-                           [&engine, safe] (const juce::FileChooser& c) {
+                           // (round 190sk) the callback keeps the chooser alive (it died here before: nothing happened)
+                           [&engine, safe, chooser] (const juce::FileChooser& c) {
                                auto target = c.getResult();
                                if (target == juce::File())
                                    return;

+ 2 - 0
src/ui/MainComponent.h

@@ -106,6 +106,8 @@ public:
     void showSetupWizard(); // first run, or Options > Setup wizard (an overlay over this component)
     void closeSetupWizardForSnapshot() { setupOverlay.reset(); }
     void refreshTweakReadoutForSnapshot() { refreshTweakReadout(); resized(); }
+    // round 190sk (--selftest "menuwindows190sk"): a menu of the menu bar as clicking its name builds it
+    juce::PopupMenu menuForCheck (int index, const juce::String& name) { return getMenuForIndex (index, name); }
 
     // Asks "save changes?" if there are any; `then` runs unless the user cancels.
     void confirmDiscard (std::function<void()> then);