From 1f66d914e435e733a7741e6b98abf92594122c01 Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Sat, 17 Oct 2020 21:09:24 +0200 Subject: QMutableEventPoint::detach: deref old private After detaching, the current QMutableEventPoint obviously doesn't reference old QMutableEventPointPrivate anymore. Deref it, so that we do not leak memory. Change-Id: I3b59667603d41f452eead9a2db13e1d005f622ec Reviewed-by: Volker Hilsheimer Reviewed-by: Shawn Rutledge --- src/gui/kernel/qevent.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gui/kernel/qevent.cpp') diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index d34b74d9d0..5a539ccaf6 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -479,8 +479,10 @@ void QMutableEventPoint::detach() if (d->refCount == 1) return; // no need: there is only one QEventPoint using it qCDebug(lcEPDetach) << "detaching: refCount" << d->refCount << this; + auto old = d; d = new QEventPointPrivate(*d); d->refCount = 1; + --old->refCount; } /*! \internal -- cgit v1.2.1