mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-22 01:34:21 +00:00
Projucer: Fixed a crash that could occur when saving a project multiple times
This commit is contained in:
parent
472c5616d4
commit
b288da58f0
4 changed files with 19 additions and 3 deletions
|
|
@ -810,7 +810,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
|
|||
result.setInfo ("Save Project",
|
||||
"Saves the current project",
|
||||
CommandCategories::general, 0);
|
||||
result.setActive (project != nullptr);
|
||||
result.setActive (project != nullptr && ! project->isCurrentlySaving());
|
||||
break;
|
||||
|
||||
case CommandIDs::closeProject:
|
||||
|
|
@ -824,7 +824,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
|
|||
result.setInfo ("Save" + documentName,
|
||||
"Saves the current document",
|
||||
CommandCategories::general, 0);
|
||||
result.setActive (currentDocument != nullptr || project != nullptr);
|
||||
result.setActive (currentDocument != nullptr || (project != nullptr && ! project->isCurrentlySaving()));
|
||||
result.defaultKeypresses.add (KeyPress ('s', ModifierKeys::commandModifier, 0));
|
||||
break;
|
||||
|
||||
|
|
@ -935,7 +935,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
|
|||
result.setInfo ("Save Project and Open in IDE...",
|
||||
"Saves the project and launches it in an external IDE",
|
||||
CommandCategories::general, 0);
|
||||
result.setActive (ProjectExporter::canProjectBeLaunched (project));
|
||||
result.setActive (ProjectExporter::canProjectBeLaunched (project) && ! project->isCurrentlySaving());
|
||||
result.defaultKeypresses.add (KeyPress ('l', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0));
|
||||
break;
|
||||
|
||||
|
|
@ -1049,6 +1049,10 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
|
|||
|
||||
bool ProjectContentComponent::perform (const InvocationInfo& info)
|
||||
{
|
||||
// don't allow the project to be saved again if it's currently saving
|
||||
if (isSaveCommand (info.commandID) && (project != nullptr && project->isCurrentlySaving()))
|
||||
return false;
|
||||
|
||||
switch (info.commandID)
|
||||
{
|
||||
case CommandIDs::saveProject:
|
||||
|
|
@ -1121,6 +1125,11 @@ bool ProjectContentComponent::perform (const InvocationInfo& info)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ProjectContentComponent::isSaveCommand (const CommandID id)
|
||||
{
|
||||
return (id == CommandIDs::saveProject || id == CommandIDs::saveDocument || id == CommandIDs::saveAndOpenInIDE);
|
||||
}
|
||||
|
||||
void ProjectContentComponent::getSelectedProjectItemsBeingDragged (const DragAndDropTarget::SourceDetails& dragSourceDetails,
|
||||
OwnedArray<Project::Item>& selectedNodes)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue