diff --git a/extras/Projucer/Source/Application/jucer_MainWindow.cpp b/extras/Projucer/Source/Application/jucer_MainWindow.cpp index 10079fb25e..ca750a3e23 100644 --- a/extras/Projucer/Source/Application/jucer_MainWindow.cpp +++ b/extras/Projucer/Source/Application/jucer_MainWindow.cpp @@ -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); }); }); } diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectSaver.cpp b/extras/Projucer/Source/ProjectSaving/jucer_ProjectSaver.cpp index e4dd8d0037..fcfa71b003 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectSaver.cpp +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectSaver.cpp @@ -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(); }