Repository: thrift Updated Branches: refs/heads/master 19baeefd8 -> c54a90d12
THRIFT-4189 Framed/buffered transport Dispose() does not dispose the nested transport Client: C# Patch: Jens Geyer Project: http://git-wip-us.apache.org/repos/asf/thrift/repo Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/c54a90d1 Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/c54a90d1 Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/c54a90d1 Branch: refs/heads/master Commit: c54a90d12d7ca05de88dfaa5d569dbb96dd83317 Parents: 19baeef Author: Jens Geyer <[email protected]> Authored: Sat May 6 00:50:07 2017 +0200 Committer: Jens Geyer <[email protected]> Committed: Sat May 6 00:58:05 2017 +0200 ---------------------------------------------------------------------- lib/csharp/src/Transport/TBufferedTransport.cs | 8 ++++++-- lib/csharp/src/Transport/TFramedTransport.cs | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/thrift/blob/c54a90d1/lib/csharp/src/Transport/TBufferedTransport.cs ---------------------------------------------------------------------- diff --git a/lib/csharp/src/Transport/TBufferedTransport.cs b/lib/csharp/src/Transport/TBufferedTransport.cs index caedd87..c969419 100644 --- a/lib/csharp/src/Transport/TBufferedTransport.cs +++ b/lib/csharp/src/Transport/TBufferedTransport.cs @@ -154,8 +154,12 @@ namespace Thrift.Transport { if (disposing) { - inputBuffer.Dispose(); - outputBuffer.Dispose(); + if(inputBuffer != null) + inputBuffer.Dispose(); + if(outputBuffer != null) + outputBuffer.Dispose(); + if(transport != null) + transport.Dispose(); } } _IsDisposed = true; http://git-wip-us.apache.org/repos/asf/thrift/blob/c54a90d1/lib/csharp/src/Transport/TFramedTransport.cs ---------------------------------------------------------------------- diff --git a/lib/csharp/src/Transport/TFramedTransport.cs b/lib/csharp/src/Transport/TFramedTransport.cs index a369e8e..0af8b1f 100644 --- a/lib/csharp/src/Transport/TFramedTransport.cs +++ b/lib/csharp/src/Transport/TFramedTransport.cs @@ -171,8 +171,12 @@ namespace Thrift.Transport { if (disposing) { - readBuffer.Dispose(); - writeBuffer.Dispose(); + if(readBuffer != null) + readBuffer.Dispose(); + if(writeBuffer != null) + writeBuffer.Dispose(); + if(transport != null) + transport.Dispose(); } } _IsDisposed = true;
