Switch the check which tests whether the object has been finalised from being a use-after-free, to using a weak pointer which is nullified on finalisation. Signed-off-by: Philip Withnall <withnall@endlessm.com>