summaryrefslogtreecommitdiffstats
path: root/src/tools/uic/cpp/cppwriteincludes.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2024-07-04 14:21:15 +0200
committerMarc Mutz <marc.mutz@qt.io>2024-07-06 09:31:09 +0200
commit11725d46344105325a1dec8628708ab88483ca12 (patch)
tree6f926e84bed4b6366906ea2985c15b32e4975565 /src/tools/uic/cpp/cppwriteincludes.cpp
parent16483487c4e37546cf296a72e137d49d28b55e05 (diff)
QRestAccessManager: don't leak slot objects when no QNAM was set
We try to pass QSlotObjectBase as raw pointer through the ABI boundary, because we hope to have the template-wrapper tail-call the out-of-line helper¹. But that means that the out-of-line helper needs to ensure that it deletes the slot object on every possible exit from the function. The old code didn't do that e.g. when the qnam check failed, or, theoretically, if requestOperation() threw an exception. The new code places the slot object under SlotObjUniquePtr guard as soon as possible (but, due to amount of callers, not before executeRequest()). Port createActiveRequest() to receive the slot object already in a smart pointer. Tail-calling isn't required here, because caller and callee are part of the same TU so the optimizer can do whatever it wants. Unique_ptr passing shouldn't be that hard to optimize. ¹ If we were to pass by SlotObjUniquePtr, tail-calling would be impossible due to the need to run the unique_ptr's dtor after he call to the helper. Amends 9ba5c7ff6aa42c5701cf950d2137467a2d178833, but e560adef213301318dcc13d4db155624846e0420 already had the requestOperation() problem. Pick-to: 6.8 6.7 Change-Id: I2ab5eadb35625393f274e3391d7b7c393ed8f08a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/tools/uic/cpp/cppwriteincludes.cpp')
0 files changed, 0 insertions, 0 deletions