It's impossible to answer your question, because we can't figure out if the caller or callee is responsible or not.
Unless you use queued connections, a signal-slot connection is just a function call. So it should be safe to delete the pointer at the end of the slot. If this is the case, I'd use auto_ptr. (Not that I would ever emit pointers unless I was absolutely forced to.) But if you are using queued connections, which is the case if it's across threads, then you have no idea if it's safe or not.
Instead, you should recode your application to emit something that is not a pointer. In the code you offer, the pointer is only used to get a bool. In that case, emit the bool directly.
If you are worried about performance, in case your object isn't just a bool but might be huge, you can create your own implicitly shared object type and have copy-on-write. If you have coded this const-correctly, that should fix your problems.
You can also emit a QSharedPointer<whatever*>, but you might have to register this type to QVariant.
Of all these solutions, there is only one that really makes sense: Don't emit pointers.
Bookmarks