diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-06-11 09:43:37 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-06-11 19:45:27 +0200 |
commit | 44fa80cbd4fabd6d7b87e7a50233f7dbeaf303b4 (patch) | |
tree | ea207cd05015129a2f0c285e306406ab99cf2b37 /tests/auto/corelib/io/qsettings | |
parent | 1d05dcb3ec677a301a5a626384b2bf8003af2663 (diff) |
QObject: Fix memory leak in queued_activate
queued_activate adds a reference to the slot object. It also attempts to
deref it again, but that did not work correctly so far. We could end up
with
T1 | T2
queued_activate |
checks isSlotObject |
adds ref |
locker.unlock() |
| QObject::~QObject
| //In disconnect all senders loop
| sets isSlotObject to false
| derefs slotObj, but not deleted
checks isSlotObject |
(no deref because it's null) |
To solve this issue and others caused by early returns, we now use a
RAII helper, which always takes care of calling destroyIfLastRef if the
ref count has been incremented.
Change-Id: I9c011cdb8faa5f344d7e70f024fc13f407e39ccf
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests/auto/corelib/io/qsettings')
0 files changed, 0 insertions, 0 deletions