QBluetoothSocketBasePrivate: ensure q_ptr is always initialized


Coverity complained that QBluetoothSocketBasePrivate didn't init
q_ptr, but that (and this Coverity didn't understand) callers are
supposed to do it. AFAICT, they all did, but this pattern, though
historically state of the art in Qt, is brittle.

So port to the Pimp My Pimpl version¹, passing the back-link as a
constructor argument. This way, it cannot be forgotten (the
roundabout construction of Private and Public in the bluez code
notwithstanding). It's also how the server, the discovery agents
and the QBluetoothLocalDevices populate their q_ptr.

¹ https://marcmutz.wordpress.com/translated-articles/pimp-my-pimpl-reloaded/#back-link

Amends 28eeb7afc27e99deeb52eefe10cdd458c7621698 (5.12).

Pick-to: 6.12 6.8
Coverity-Id: 914228
Change-Id: Ie048a5f3220b6c5f644d543ff733533a5bb602e0
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
commitab0fe7449a4a4424f82fc9d4e0ce3a11068171db
parent157dac3a625cdafb7fb3a702eedc4b13a88834ed
authorMarc Mutz <marc.mutz@qt.io>
committerMarc Mutz <marc.mutz@qt.io>
commit timeMon, 19 Oct 2026 21:03:52 +0000