summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2013-10-25 12:37:30 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-05 09:16:41 +0100
commit142c5ef9ddd17e59d8d096ab065aee8cb50f5e8f (patch)
tree99df987fd2b259287d109f7f841c3943e0626130 /src
parente9c51a1fdc9092e5589fd6f823ad0e704e293c88 (diff)
QLineEdit: Fix potential crash when removing the clear button.
Remove it from the side actions list. Task-number: QTBUG-34315 Change-Id: I70063351193b504f8656e903896d155ac74f73a6 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/widgets/qlineedit.cpp4
-rw-r--r--src/widgets/widgets/qlineedit_p.cpp3
-rw-r--r--src/widgets/widgets/qlineedit_p.h2
3 files changed, 4 insertions, 5 deletions
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index d3c37ab612..0bc7b7c2e3 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -500,7 +500,7 @@ void QLineEdit::setClearButtonEnabled(bool enable)
} else {
QAction *clearAction = findChild<QAction *>(QLatin1String(clearButtonActionNameC));
Q_ASSERT(clearAction);
- removeAction(clearAction);
+ d->removeAction(clearAction);
delete clearAction;
}
}
@@ -1439,7 +1439,7 @@ bool QLineEdit::event(QEvent * e)
d->setCursorVisible(true);
}
} else if (e->type() == QEvent::ActionRemoved) {
- d->removeAction(static_cast<QActionEvent *>(e));
+ d->removeAction(static_cast<QActionEvent *>(e)->action());
} else if (e->type() == QEvent::Resize) {
d->positionSideWidgets();
}
diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp
index 99d6d0b8d9..c066f74c5a 100644
--- a/src/widgets/widgets/qlineedit_p.cpp
+++ b/src/widgets/widgets/qlineedit_p.cpp
@@ -445,10 +445,9 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE
return w;
}
-void QLineEditPrivate::removeAction(const QActionEvent *e)
+void QLineEditPrivate::removeAction(QAction *action)
{
Q_Q(QLineEdit);
- QAction *action = e->action();
const PositionIndexPair positionIndex = findSideWidget(action);
if (positionIndex.second == -1)
return;
diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h
index 8fe45972ff..e807c7fc52 100644
--- a/src/widgets/widgets/qlineedit_p.h
+++ b/src/widgets/widgets/qlineedit_p.h
@@ -196,7 +196,7 @@ public:
QString placeholderText;
QWidget *addAction(QAction *newAction, QAction *before, QLineEdit::ActionPosition, int flags = 0);
- void removeAction(const QActionEvent *e);
+ void removeAction(QAction *action);
QSize iconSize() const;
QIcon clearButtonIcon() const;
void positionSideWidgets();