I would consider ptrObject and all other stuff in the union internal data, so there should be no public method to access them.
Also, ptrObject is used as hash key in our this case, but it's not a general hash value for GVariant.