QBinaryJson: avoid needless ref-count round-trip in detach()


Coverity complained about a USE_AFTER_FREE in these two functions,
because it sees clone() return `this` but doesn't understand that the
delete d can never happen if the x->ref() upped the refcount that
d->deref() then downs. So, False Positive, but the ref-count
round-trip it points at was, indeed, needless.

Skip the dance when clone() didn't actually give us a new object.

Pick-to: 6.12 6.11 6.8
Coverity-Id: 390809
Coverity-Id: 390817
Change-Id: I8d86321ee250c9acc1d424ee7bd6bca21b9ef443
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
commitae1141139679bd58d0108fc65068df990dbfc7aa
parent03c1e95f10da195b934dc458f5219022ec6e5ea2
authorMarc Mutz <marc.mutz@qt.io>
committerMarc Mutz <marc.mutz@qt.io>
commit timeSun, 6 Sep 2026 07:26:22 +0000