Subject: Re: [boost] Solving Robert's singleton problem
From: Alexander Grund (alexander.grund_at_[hidden])
Date: 2018-10-19 07:14:42
> The problem has already been fixed, by Alexander Grund. The fix, in
> its latest incarnation, is in #131.
> To recap,
> - the Serialization library crashes on exit in certain scenarios, as
> demonstrated by the tests in #111 and #128.
> - this is caused by the fact that singleton<X>::is_destroyed() always
> returns false, as demonstrated by the test in #129.
> (At extended_type_info_typeid.cpp:99, the code tests
> singleton<tkmap>::is_destroyed(), and if false, proceeds to use
> singleton<tkmap>::get_mutable_instance(). But since is_destroyed
> always returns false, the check doesn't work and doesn't prevent the
> library from accessing the destroyed tkmap in the scenario in question.)
> - a fix for is_destroyed() is proposed in #131. It makes the tests
> from #111/#128/#129 pass.
Thanks for voicing this again.
From the comments of you (and a few others) I condensed the fix code,
and (tried to) make the tests and fix more easily understandable. As
such the code comments in the fix are absolutely essential so future
developers won't break it again.
These comments and the discussion about it were the reason to bring it
up in this way. The tests and fix were already there but not merged for
reasons absolutely unclear to me as there was no discussion. This
discussion brought some of them up so I could work on them. Thanks again.
Minor note: "singleton<X>::is_destroyed() always returns false" is not
completely true. There is 1 use case where it does return true: "struct
Foo: singleton<Foo>" (as shown in the test). So the correct statement
would be "singleton<X>::is_destroyed() always returns false when X does
not inherit from singleton<X>". Note that this is the 2nd official use case.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk