Do delete on QMetaType::destroy() even without dtor
As we call operator new on create(), we also need to delete on destroy(). Otherwise we leak memory. Change-Id: Ib80fe96c4173cba6fa474d3c81d88fe603d1ded2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
d6a8560eae
commit
38d1444a60
@ -594,8 +594,9 @@ void *QMetaType::create(const void *copy) const
|
||||
*/
|
||||
void QMetaType::destroy(void *data) const
|
||||
{
|
||||
if (d_ptr && d_ptr->dtor) {
|
||||
d_ptr->dtor(d_ptr, data);
|
||||
if (d_ptr) {
|
||||
if (d_ptr->dtor)
|
||||
d_ptr->dtor(d_ptr, data);
|
||||
if (d_ptr->alignment > __STDCPP_DEFAULT_NEW_ALIGNMENT__) {
|
||||
operator delete(data, std::align_val_t(d_ptr->alignment));
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user