QEasingCurve: fix mem leak in operator>>

The code ignored that the QEasingCurve passed in to op>>
might already have a QEasingCurveFunction set, overwriting
it with a new pointer without deleting the old.

Change-Id: Ic14cf7e4b97c7c8c7edb64cde08fbf22c07ac8f3
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
Marc Mutz 2014-10-16 10:14:08 +02:00
parent 665966d243
commit 9dcc38b566

View File

@ -1497,6 +1497,8 @@ QDataStream &operator>>(QDataStream &stream, QEasingCurve &easing)
bool hasConfig;
stream >> hasConfig;
delete easing.d_ptr->config;
easing.d_ptr->config = Q_NULLPTR;
if (hasConfig) {
QEasingCurveFunction *config = curveToFunctionObject(type);
stream >> config->_p;