QVariant: make sure to default-initialize in v_construct

Otherwise it's possible to get garbage for primitive types (trivially
constructible) under some conditions.

Change-Id: I408dcb81ba654c929f25ffff142885fc62395948
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
bb10
Thiago Macieira 2016-01-11 16:23:18 -08:00
parent 650b4d0f49
commit 5e1a5a78d9
1 changed files with 1 additions and 1 deletions

View File

@ -121,7 +121,7 @@ inline void v_construct(QVariant::Private *x, const void *copy, T * = 0)
if (copy)
new (&x->data.ptr) T(*static_cast<const T *>(copy));
else
new (&x->data.ptr) T;
new (&x->data.ptr) T();
}
}