This is source of many crashes in QML. Even when the object has parent or C++ ownership it might be bad practice.
For me it was unexpected that class marked as Q_GADGET can not be returned via Q_INVOKABLE