[API] Make set_user_data() functions take a replace parameter

We need this to set data on objects safely without worrying that some
other thread unsets it by setting it at the same time.
14 files changed