Skip to content

Commit

Permalink
PR - Jira issues: [DYN-3890] | [DYN-3963] (#12015)
Browse files Browse the repository at this point in the history
* Fixed crash as a result of frozen node + pin.

-Also added `HasUnsavedChanges

* PR fix.
  • Loading branch information
M-JULIANI authored Sep 7, 2021
1 parent f19a7c0 commit bd5e1a6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/DynamoCore/Core/UndoRedoRecorder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ public ModelModificationUndoHelper(UndoRedoRecorder recorder, IEnumerable<ModelB

this.models = new List<ModelBase>(models);
existingConnectors = new Dictionary<Guid, XmlElement>();
existingPins = new Dictionary<Guid, XmlElement>();
remainingConnectors = new Dictionary<Guid, ConnectorModel>();

var allConnectors = new List<ConnectorModel>();
Expand Down
1 change: 1 addition & 0 deletions src/DynamoCore/Graph/Workspaces/UndoRedo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ internal void RecordAndDeleteModels(List<ModelBase> models)
var matchingConnector = Connectors.FirstOrDefault(c => c.GUID == connectorPinModel.ConnectorId);
if (matchingConnector is null) return;
matchingConnector.ConnectorPinModels.Remove(connectorPinModel);
HasUnsavedChanges = true;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/DynamoCoreWpf/ViewModels/Core/ConnectorPinViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ public Guid ConnectorGuid
private void UnpinWireCommandExecute(object parameter)
{
OnRequestRemove(this, EventArgs.Empty);
WorkspaceViewModel.Model.HasUnsavedChanges = true;
}

private void InitializeCommands()
Expand Down
2 changes: 2 additions & 0 deletions src/DynamoCoreWpf/ViewModels/Core/ConnectorViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,7 @@ private void HideConnectorCommandExecute(object parameter)
{
IsPartlyVisible = false;
}
workspaceViewModel.Model.HasUnsavedChanges = true;
}
/// <summary>
/// Selects nodes connected to this wire.
Expand All @@ -729,6 +730,7 @@ private void PinConnectorCommandExecute(object parameters)
var connectorPinModel = new ConnectorPinModel(MousePosition.X, MousePosition.Y, Guid.NewGuid(), model.GUID);
ConnectorModel.AddPin(connectorPinModel);
workspaceViewModel.Model.RecordCreatedModel(connectorPinModel);
workspaceViewModel.Model.HasUnsavedChanges = true;
}

/// <summary>
Expand Down

0 comments on commit bd5e1a6

Please sign in to comment.