No more messing up enable_shared_from_this refcounts

Modified the polymorphic saving of pointers to use a second
shared_ptr to manage the refcount of the wrapper proper polymorphic
shared_ptr (previously we were using an empty deleter).  The result of
this is that the wrapper doesn't actually manage the pointer it holds,
it just allows access to it so long as there is still a refcount in
the second refcount pointer.

Modified the polymorphic wrapper and enable shared from this state
saver to be RAII style.
Adding valgrind to travis