diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index a37c263c..3a3f075f 100644 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -2,6 +2,7 @@ Fixes: ------ +#1076: Wrong object selected when duplicating connection then switching between properties and inheritance in config window #1068: Fixed some toolbar positioning bugs diff --git a/mRemoteNGTests/Connection/ConnectionInfoTests.cs b/mRemoteNGTests/Connection/ConnectionInfoTests.cs index fb809f38..9e127a0b 100644 --- a/mRemoteNGTests/Connection/ConnectionInfoTests.cs +++ b/mRemoteNGTests/Connection/ConnectionInfoTests.cs @@ -43,6 +43,20 @@ namespace mRemoteNGTests.Connection Assert.That(clonedConnection.Parent, Is.Null); } + [Test] + public void CloneAlsoCopiesInheritanceObject() + { + var clonedConnection = _connectionInfo.Clone(); + Assert.That(clonedConnection.Inheritance, Is.Not.EqualTo(_connectionInfo.Inheritance)); + } + + [Test] + public void CloneCorrectlySetsParentOfInheritanceObject() + { + var clonedConnection = _connectionInfo.Clone(); + Assert.That(clonedConnection.Inheritance.Parent, Is.EqualTo(clonedConnection)); + } + [Test] public void CopyFromCopiesProperties() { diff --git a/mRemoteV1/Connection/ConnectionInfo.cs b/mRemoteV1/Connection/ConnectionInfo.cs index 646ddda7..64a0702d 100644 --- a/mRemoteV1/Connection/ConnectionInfo.cs +++ b/mRemoteV1/Connection/ConnectionInfo.cs @@ -78,7 +78,8 @@ namespace mRemoteNG.Connection var newConnectionInfo = new ConnectionInfo(); newConnectionInfo.CopyFrom(this); newConnectionInfo.Inheritance = Inheritance.Clone(); - return newConnectionInfo; + newConnectionInfo.Inheritance.Parent = newConnectionInfo; + return newConnectionInfo; } public void CopyFrom(ConnectionInfo sourceConnectionInfo)