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>
| commit | ab0fe7449a4a4424f82fc9d4e0ce3a11068171db |
| parent | 157dac3a625cdafb7fb3a702eedc4b13a88834ed |
| author | Marc Mutz <marc.mutz@qt.io> |
| committer | Marc Mutz <marc.mutz@qt.io> |
| commit time | Mon, 19 Oct 2026 21:03:52 +0000 |
- M src/bluetooth/qbluetoothserver_bluez.cpp
- M src/bluetooth/qbluetoothsocket.cpp
- M src/bluetooth/qbluetoothsocket_android.cpp
- M src/bluetooth/qbluetoothsocket_android_p.h
- M src/bluetooth/qbluetoothsocket_bluez.cpp
- M src/bluetooth/qbluetoothsocket_bluez_p.h
- M src/bluetooth/qbluetoothsocket_bluezdbus.cpp
- M src/bluetooth/qbluetoothsocket_bluezdbus_p.h
- M src/bluetooth/qbluetoothsocket_dummy.cpp
- M src/bluetooth/qbluetoothsocket_dummy_p.h
- M src/bluetooth/qbluetoothsocket_macos.mm
- M src/bluetooth/qbluetoothsocket_macos_p.h
- M src/bluetooth/qbluetoothsocket_ohos.cpp
- M src/bluetooth/qbluetoothsocket_ohos_p.h
- M src/bluetooth/qbluetoothsocket_winrt.cpp
- M src/bluetooth/qbluetoothsocket_winrt_p.h
- M src/bluetooth/qbluetoothsocketbase.cpp
- M src/bluetooth/qbluetoothsocketbase_p.h
- M src/bluetooth/qlowenergycontroller_bluez.cpp