QCache: Fix crash observed in tst_QAccessibility
Fixes a use-after-free which can reliably be observed under ASAN. In QConfFileSettingsPrivate::~QConfFileSettingsPrivate we call unusedCache->insert(conf_file->name, conf_file, ...) Note that the key is a member of the object. Thus by deleting the object before using the key, we dereference a dangling pointer. Amends f08492c6fd9818c7d80b1725355453e179b4d85b. Pick-to: dev 6.0.0 Change-Id: I3a550fc73446b72dd46456232e85f6d206d64c01 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
This commit is contained in:
parent
f4ff1e73b0
commit
5283ee7104
@ -237,8 +237,8 @@ public:
|
||||
bool insert(const Key &key, T *object, qsizetype cost = 1)
|
||||
{
|
||||
if (cost > mx) {
|
||||
delete object;
|
||||
remove(key);
|
||||
delete object;
|
||||
return false;
|
||||
}
|
||||
trim(mx - cost);
|
||||
|
Loading…
x
Reference in New Issue
Block a user