def safe_call(callbacks)
      cbs = callbacks.dup

      # exceptions in these hooks will be raised normally

      while cb = cbs.shift
        cb.call
      end
    end
def safe_call(callbacks)
      cbs = callbacks.dup

      # exceptions in these hooks will be raised normally

      while cb = cbs.shift
        cb.call
      end
    end
do :call on each of callbacks. if a WeakRef::RefError
 is caught, modify `callbacks` by removing the dud reference

 @private