1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Projucer: Ensure that saving always continues after moving a project

This commit is contained in:
reuk 2021-11-22 10:59:57 +00:00
parent 5a621e811f
commit f1e766ec18
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
2 changed files with 9 additions and 5 deletions

View file

@ -300,11 +300,16 @@ void MainWindow::moveProject (File newProjectFileToOpen, OpenInIDE openInIDE)
parent->openFile (newProjectFileToOpen, [parent, openInIDE] (bool openedSuccessfully)
{
if (parent == nullptr)
if (! (openedSuccessfully && parent != nullptr && parent->currentProject != nullptr && openInIDE == OpenInIDE::yes))
return;
if (openedSuccessfully && parent->currentProject != nullptr && openInIDE == OpenInIDE::yes)
ProjucerApplication::getApp().getCommandManager().invokeDirectly (CommandIDs::saveAndOpenInIDE, false);
// The project component knows how to process the saveAndOpenInIDE command, but the
// main application does not. In order to process the command successfully, we need
// to ensure that the project content component has focus.
auto& manager = ProjucerApplication::getApp().getCommandManager();
manager.setFirstCommandTarget (parent->getProjectContentComponent());
ProjucerApplication::getApp().getCommandManager().invokeDirectly (CommandIDs::saveAndOpenInIDE, false);
manager.setFirstCommandTarget (nullptr);
});
});
}

View file

@ -64,8 +64,7 @@ void ProjectSaver::saveProjectAsync (ProjectExporter* exporterToSave, std::funct
ref->saveThread->waitForThreadToExit (-1);
ref->saveThread = nullptr;
if (onCompletion != nullptr)
onCompletion (result);
NullCheckedInvocation::invoke (onCompletion, result);
});
saveThread->launchThread();
}