Skip to content

Commit b06c8e4

Browse files
authored
Merge branch '5.3.x' into gha
2 parents 87b1a35 + 4fa82e8 commit b06c8e4

File tree

2 files changed

+2
-25
lines changed

2 files changed

+2
-25
lines changed

src/NHibernate/Impl/SessionImpl.cs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,14 +1483,6 @@ public void Reconnect(DbConnection conn)
14831483
private string fetchProfile;
14841484
private IDisposable _context;
14851485

1486-
/// <summary>
1487-
/// Finalizer that ensures the object is correctly disposed of.
1488-
/// </summary>
1489-
~SessionImpl()
1490-
{
1491-
Dispose(false);
1492-
}
1493-
14941486
/// <summary>
14951487
/// Perform a soft (distributed transaction aware) close of the session
14961488
/// </summary>
@@ -1517,15 +1509,12 @@ public void Dispose()
15171509
_context?.Dispose();
15181510
}
15191511

1512+
//TODO: Get rid of isDisposing parameter. Finalizer is removed as not needed, so isDisposing is always true
15201513
/// <summary>
15211514
/// Takes care of freeing the managed and unmanaged resources that
15221515
/// this class is responsible for.
15231516
/// </summary>
15241517
/// <param name="isDisposing">Indicates if this Session is being Disposed of or Finalized.</param>
1525-
/// <remarks>
1526-
/// If this Session is being Finalized (<c>isDisposing==false</c>) then make sure not
1527-
/// to call any methods that could potentially bring this Session back to life.
1528-
/// </remarks>
15291518
private void Dispose(bool isDisposing)
15301519
{
15311520
using (BeginContext())
@@ -1546,8 +1535,6 @@ private void Dispose(bool isDisposing)
15461535
{
15471536
Close();
15481537
}
1549-
// nothing for Finalizer to do - so tell the GC to ignore it
1550-
GC.SuppressFinalize(this);
15511538
}
15521539

15531540
// free unmanaged resources here

src/NHibernate/Impl/StatelessSessionImpl.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -759,14 +759,6 @@ public IQueryOver<T, T> QueryOver<T>(Expression<Func<T>> alias) where T : class
759759
private bool _isAlreadyDisposed;
760760
private IDisposable _context;
761761

762-
/// <summary>
763-
/// Finalizer that ensures the object is correctly disposed of.
764-
/// </summary>
765-
~StatelessSessionImpl()
766-
{
767-
Dispose(false);
768-
}
769-
770762
///<summary>
771763
///Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
772764
///</summary>
@@ -793,6 +785,7 @@ public void Dispose()
793785
}
794786
}
795787

788+
//TODO: Get rid of isDisposing parameter. Finalizer is removed as not needed, so isDisposing is always true
796789
protected void Dispose(bool isDisposing)
797790
{
798791
using (BeginContext())
@@ -811,9 +804,6 @@ protected void Dispose(bool isDisposing)
811804
{
812805
Close();
813806
}
814-
815-
// nothing for Finalizer to do - so tell the GC to ignore it
816-
GC.SuppressFinalize(this);
817807
}
818808

819809
// free unmanaged resources here

0 commit comments

Comments
 (0)