diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-10-21 14:09:00 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-10-24 10:20:05 +0200 |
commit | 31a971f727ecf0c6651689f052b9fb4c67872b58 (patch) | |
tree | 446245d9c3a8fb49a3a26879fd8d18a2f7e41a67 | |
parent | b61c6164c100defc519b178d73858df59cffc48d (diff) |
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>
-rw-r--r-- | src/widgets/dialogs/qcolordialog.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index 1cb6cb8a2d..197d1d940b 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -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(); |