QColorDialog: Fix memory leak when picking screen colors

Pass the dialog as parent to the event filter class
in QColorDialogPrivate::_q_pickScreenColor().

Fixes: QTBUG-53469
Change-Id: I9110c19a8f49a545a0fbf7cfdb3ded70fea4dcce
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
bb10
Friedemann Kleint 2019-10-21 14:09:00 +02:00
parent b61c6164c1
commit 31a971f727
1 changed files with 2 additions and 2 deletions

View File

@ -499,7 +499,7 @@ void QWellArray::keyPressEvent(QKeyEvent* e)
// Event filter to be installed on the dialog while in color-picking mode.
class QColorPickingEventFilter : public QObject {
public:
explicit QColorPickingEventFilter(QColorDialogPrivate *dp, QObject *parent = 0) : QObject(parent), m_dp(dp) {}
explicit QColorPickingEventFilter(QColorDialogPrivate *dp, QObject *parent) : QObject(parent), m_dp(dp) {}
bool eventFilter(QObject *, QEvent *event) override
{
@ -1606,7 +1606,7 @@ void QColorDialogPrivate::_q_pickScreenColor()
{
Q_Q(QColorDialog);
if (!colorPickingEventFilter)
colorPickingEventFilter = new QColorPickingEventFilter(this);
colorPickingEventFilter = new QColorPickingEventFilter(this, q);
q->installEventFilter(colorPickingEventFilter);
// If user pushes Escape, the last color before picking will be restored.
beforeScreenColorPicking = cs->currentColor();