Fix race condition in setting up RString data

We only set the type in the end if everything is ready. Before we had a
race condition where type_ was already set to cRString, but the data
wasn't allocated yet. By setting up a memory barrier and setting the
type after that, we make sure all the data is initialized properly.