Fix shared_ptr of classes with private constructors and destructors.

Usually these use a custom deleter passed to the shared_ptr.
This also fixes the "unref" feature when used on classes with private destructors.
This commit is contained in:
William S Fulton 2015-05-14 18:38:32 +01:00
commit 54e2317b24
5 changed files with 53 additions and 0 deletions

View file

@ -16,5 +16,12 @@ public class runme
HiddenDestructor hidden = HiddenDestructor.create();
hidden.Dispose();
HiddenPrivateDestructor hiddenPrivate = HiddenPrivateDestructor.create();
if (HiddenPrivateDestructor.DeleteCount != 0)
throw new ApplicationException("Count should be zero");
hiddenPrivate.Dispose();
if (HiddenPrivateDestructor.DeleteCount != 1)
throw new ApplicationException("Count should be one");
}
}