QGestureManager: use QScopedPointer to hold prototype gesture
When registering a QGestureRecognizer, we create a prototype QGesture to ask for it's QGesture::type(). Instead of a manual delete, use a QScopedPointer to hold it. Change-Id: I5cf1ad95864265b7d465b6344751acfb19a16800 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
This commit is contained in:
parent
a6351be355
commit
e136565505
@ -122,7 +122,7 @@ QGestureManager::~QGestureManager()
|
||||
|
||||
Qt::GestureType QGestureManager::registerGestureRecognizer(QGestureRecognizer *recognizer)
|
||||
{
|
||||
QGesture *dummy = recognizer->create(0);
|
||||
const QScopedPointer<QGesture> dummy(recognizer->create(nullptr));
|
||||
if (Q_UNLIKELY(!dummy)) {
|
||||
qWarning("QGestureManager::registerGestureRecognizer: "
|
||||
"the recognizer fails to create a gesture object, skipping registration.");
|
||||
@ -135,7 +135,6 @@ Qt::GestureType QGestureManager::registerGestureRecognizer(QGestureRecognizer *r
|
||||
type = Qt::GestureType(m_lastCustomGestureId);
|
||||
}
|
||||
m_recognizers.insertMulti(type, recognizer);
|
||||
delete dummy;
|
||||
return type;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user