[CoreGraphics] Fix issue with the MakeMutable in CGPath where ref count was leaking. (#3228)

This commit is contained in:
Manuel de la Pena 2018-01-15 22:35:05 +01:00 коммит произвёл Sebastien Pouliot
Родитель f43cb7eefa
Коммит a52748277d
2 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -560,7 +560,7 @@ namespace XamCore.CoreGraphics {
static CGPath MakeMutable (IntPtr source)
{
var mutable = CGPathCreateMutableCopy (source);
return new CGPath (mutable, false);
return new CGPath (mutable, owns: true);
}
[DllImport (Constants.CoreGraphicsLibrary)]

Просмотреть файл

@ -275,8 +275,9 @@ namespace MonoTouchFixtures.CoreGraphics {
using (var copy = p1.Copy ())
{
var newRetainCount = CFGetRetainCount (copy.Handle);
Assert.AreNotEqual (count, newRetainCount, $"Count is {newRetainCount} and was {count}");
Assert.IsTrue (count < newRetainCount);
Assert.AreEqual (count, newRetainCount, "Ref count should not have changed.");
Assert.AreEqual (1, count, "Original count.");
Assert.AreEqual (1, newRetainCount, "New count");
}
}
}