Skip to content

Commit

Permalink
[foundation] Remove duplicated code from UnmanagedMemoryStreamWithRef (
Browse files Browse the repository at this point in the history
…dotnet#3769)

The base type, `UnmanagedMemoryStreamWithRef`, already handle the
reference to the `NSData` and the related `Dispose` logic
  • Loading branch information
spouliot authored Mar 19, 2018
1 parent 7f46564 commit dd01b34
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/Foundation/NSData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public static NSData FromStream (Stream stream)
// Keeps a ref to the source NSData
//
unsafe class UnmanagedMemoryStreamWithRef : UnmanagedMemoryStream {
NSData source;
protected NSData source;

public UnmanagedMemoryStreamWithRef (NSData source) : base ((byte *)source.Bytes, (long)source.Length)
{
Expand All @@ -149,19 +149,11 @@ protected override void Dispose (bool disposing)
// displays an error if the NSMutableData changes while the stream is used
//
unsafe class UnmanagedMemoryStreamWithMutableRef : UnmanagedMemoryStreamWithRef {
NSData source;
IntPtr base_address;

public UnmanagedMemoryStreamWithMutableRef (NSData source) : base (source)
{
base_address = source.Bytes;
this.source = source;
}

protected override void Dispose (bool disposing)
{
source = null;
base.Dispose (disposing);
}

static void InvalidOperation ()
Expand Down

0 comments on commit dd01b34

Please sign in to comment.