mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -129,6 +129,8 @@ public:
|
|||
void getCommandInfo (CommandID, ApplicationCommandInfo&) override;
|
||||
bool perform (const InvocationInfo&) override;
|
||||
|
||||
bool isSaveCommand (const CommandID id);
|
||||
|
||||
void paint (Graphics&) override;
|
||||
void resized() override;
|
||||
void childBoundsChanged (Component*) override;
|
||||
|
|
|
|||
|
|
@ -928,6 +928,10 @@ void Project::Item::setID (const String& newID) { state.setProperty (Ids::ID,
|
|||
Drawable* Project::Item::loadAsImageFile() const
|
||||
{
|
||||
const MessageManagerLock mml (ThreadPoolJob::getCurrentThreadPoolJob());
|
||||
|
||||
if (! mml.lockWasGained())
|
||||
return nullptr;
|
||||
|
||||
return isValid() ? Drawable::createFromImageFile (getFile())
|
||||
: nullptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -358,6 +358,7 @@ public:
|
|||
String getUniqueTargetFolderSuffixForExporter (const String& exporterName, const String& baseTargetFolder);
|
||||
|
||||
//==============================================================================
|
||||
bool isCurrentlySaving() const noexcept { return isSaving; }
|
||||
bool shouldWaitAfterSaving = false;
|
||||
String specifiedExporterToSave = {};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue