Conversation
|
Interesting, I am on Sonoma and that is what is showing complaints (I added it to a test and ran cargo test). If nullptr is never valid for xpc-object-t then you could make the ptr NonNull? I am not sure if null is ever useful? |
|
Re pub fn xpc_copy(xpc_object: NonNull<c_void>) -> Option<Self> {
// -> *mut c_void
let clone = unsafe { xpc_copy(xpc_object.as_ptr()) };
NonNull::new(clone).map(Self::new)
}What's confusing is that some of the Obj-C signatures use the xpc_object_t xpc_dictionary_create(const char *const _Nonnull *keys, xpc_object_t _Nullable const *values, size_t count);
xpc_object_t xpc_copy(xpc_object_t object);Some of the documented XPC APIs return NULL xpc_dictionary_create_reply. I need to do some homework on FFI semantics + NonNull. Then go figure out which usages it makes most sense for (here is appetizing). It might be OK to use At the very least this has convinced me to drop the current Default impl for XPCObject. |
|
Ok so a good step one would be removing default and also merging this? Then nullptr xpcobjects work, but default doesn’t make them. That would work for what I am doing right not. to do the more extreme nonnull path would involve more checking in more places and also working out whether it is ever useful to have a nullptr. |
|
Pardon the delay. I dropped |
I am not sure that implementing
Defaultfor XPCObject makes much sense. Options are:xpc_null_create()xpc_object_t(probably a good idea)Strangely enough nothing bad happens when doing this on Sonoma: