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,7 +594,8 @@ void *QMetaType::create(const void *copy) const
|
|||||||
*/
|
*/
|
||||||
void QMetaType::destroy(void *data) const
|
void QMetaType::destroy(void *data) const
|
||||||
{
|
{
|
||||||
if (d_ptr && d_ptr->dtor) {
|
if (d_ptr) {
|
||||||
|
if (d_ptr->dtor)
|
||||||
d_ptr->dtor(d_ptr, data);
|
d_ptr->dtor(d_ptr, data);
|
||||||
if (d_ptr->alignment > __STDCPP_DEFAULT_NEW_ALIGNMENT__) {
|
if (d_ptr->alignment > __STDCPP_DEFAULT_NEW_ALIGNMENT__) {
|
||||||
operator delete(data, std::align_val_t(d_ptr->alignment));
|
operator delete(data, std::align_val_t(d_ptr->alignment));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user