Fixed qthread error coming from file i/o thread
Signed-off-by: chcurran <82187351+carlitosan@users.noreply.github.com>
This commit is contained in:
@@ -203,6 +203,24 @@ namespace ScriptCanvasEditor
|
||||
ModifyNextAsset();
|
||||
}
|
||||
|
||||
void Modifier::ReportSaveResult()
|
||||
{
|
||||
AZStd::lock_guard<AZStd::recursive_mutex> lock(m_mutex);
|
||||
m_fileSaver.reset();
|
||||
|
||||
if (m_fileSaveResult.fileSaveError.empty())
|
||||
{
|
||||
ReportModificationSuccess();
|
||||
}
|
||||
else
|
||||
{
|
||||
ReportModificationError(m_fileSaveResult.fileSaveError);
|
||||
}
|
||||
|
||||
m_fileSaveResult = {};
|
||||
m_modifyState = ModifyState::Idle;
|
||||
}
|
||||
|
||||
void Modifier::OnFileSaveComplete(const FileSaveResult& result)
|
||||
{
|
||||
if (!result.tempFileRemovalError.empty())
|
||||
@@ -213,16 +231,10 @@ namespace ScriptCanvasEditor
|
||||
, result.tempFileRemovalError.c_str());
|
||||
}
|
||||
|
||||
AZStd::lock_guard<AZStd::recursive_mutex> lock(m_mutex);
|
||||
m_modifyState = ModifyState::ReportResult;
|
||||
m_fileSaver.reset();
|
||||
|
||||
if (result.fileSaveError.empty())
|
||||
{
|
||||
ReportModificationSuccess();
|
||||
}
|
||||
else
|
||||
{
|
||||
ReportModificationError(result.fileSaveError);
|
||||
}
|
||||
m_fileSaveResult = result;
|
||||
}
|
||||
|
||||
void Modifier::OnSystemTick()
|
||||
@@ -328,9 +340,18 @@ namespace ScriptCanvasEditor
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_modifyState == ModifyState::Idle)
|
||||
AZStd::lock_guard<AZStd::recursive_mutex> lock(m_mutex);
|
||||
|
||||
switch (m_modifyState)
|
||||
{
|
||||
case ScriptCanvasEditor::VersionExplorer::Modifier::ModifyState::Idle:
|
||||
ModifyCurrentAsset();
|
||||
break;
|
||||
case ScriptCanvasEditor::VersionExplorer::Modifier::ModifyState::ReportResult:
|
||||
ReportSaveResult();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,8 +58,11 @@ namespace ScriptCanvasEditor
|
||||
Idle,
|
||||
InProgress,
|
||||
Saving,
|
||||
ReportResult
|
||||
};
|
||||
|
||||
AZStd::recursive_mutex m_mutex;
|
||||
|
||||
// the two states reside in this class because the modification is only complete if the new source file saves out
|
||||
State m_state = State::GatheringDependencies;
|
||||
ModifyState m_modifyState = ModifyState::Idle;
|
||||
@@ -77,6 +80,7 @@ namespace ScriptCanvasEditor
|
||||
ModificationResult m_result;
|
||||
ModificationResults m_results;
|
||||
AZStd::unique_ptr<FileSaver> m_fileSaver;
|
||||
FileSaveResult m_fileSaveResult;
|
||||
|
||||
void GatherDependencies();
|
||||
const AZ::Data::AssetInfo& GetCurrentAsset() const;
|
||||
@@ -87,6 +91,7 @@ namespace ScriptCanvasEditor
|
||||
void ModificationComplete(const ModificationResult& result) override;
|
||||
void ReportModificationError(AZStd::string_view report);
|
||||
void ReportModificationSuccess();
|
||||
void ReportSaveResult();
|
||||
void SaveModifiedGraph(const ModificationResult& result);
|
||||
void SortGraphsByDependencies();
|
||||
void OnFileSaveComplete(const FileSaveResult& result);
|
||||
|
||||
Reference in New Issue
Block a user