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:
parent
e796ecaa23
commit
54e2317b24
5 changed files with 53 additions and 0 deletions
|
|
@ -23,5 +23,12 @@ public class li_boost_shared_ptr_bits_runme {
|
|||
|
||||
HiddenDestructor hidden = HiddenDestructor.create();
|
||||
hidden.delete();
|
||||
|
||||
HiddenPrivateDestructor hiddenPrivate = HiddenPrivateDestructor.create();
|
||||
if (HiddenPrivateDestructor.getDeleteCount() != 0)
|
||||
throw new RuntimeException("Count should be zero");
|
||||
hiddenPrivate.delete();
|
||||
if (HiddenPrivateDestructor.getDeleteCount() != 1)
|
||||
throw new RuntimeException("Count should be one");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue