Merge pull request #3968 from RosettaCommons/roccomoretti/interactive_pointer_checks
Foldit: Add checks to access_ptr usage.
Looking at some of the bug reports coming in, I have a strong suspicion that a bunch of the obscure crashes are related to memory corruption due to object lifetime issues.
Part of this might be down to Foldit's heavy reliance on access pointers. The current implementation of Foldit APs doesn't provide any guarantees/safety regarding object validity when using APs. This PR augments the current APs with a validity CheckObject which gets invalidated when the object is deleted.
To make sure checks run, I knocked out a bunch of the AP->raw pointer conversions. This has the added benefit of adding AP/OP conversion functions. This also switches boost::bind() to interactive::util::bind(), which has better support for maintaining object validity for the duration of the call to a member function callback.
The one downside for interactive::util::bind is that, due to C++ templating rules, it doesn't play well with overloaded member functions. As such, when you wrap overloaded member functions, you may need to use interactive::util::bind_op instead. (And potentially add to the bind_op rules in interactive/util/bind.hh.)
RELEASE NOTES: Improve error handling and reporting for a class of obscure crashes.