@@ -1,5 +1,5 @@
2− * Copyright 2013 Canonical Ltd.
2+ * Copyright 2013-2016 Canonical Ltd.
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
5 * it under the terms of the GNU General Public License as published by
@@ -26,9 +26,14 @@ TouchEventSequenceWrapper::TouchEventSequenceWrapper(QTest::QTouchEventSequence
27void TouchEventSequenceWrapper::commit(bool processEvents)
27void TouchEventSequenceWrapper::commit(bool processEvents)
29+ // Item might be deleted as a consequence of this event sequence being handled
30+ // So store its window beforehand
31+ QQuickWindow *window = m_item->window();
29 m_eventSequence.commit(processEvents);
33 m_eventSequence.commit(processEvents);
30− if (m_item->window()) {
35+ if (window) {
31− QQuickWindowPrivate *wp = QQuickWindowPrivate::get(m_item->window());
36+ QQuickWindowPrivate *wp = QQuickWindowPrivate::get(window);
32 wp->flushDelayedTouchEvent();
37 wp->flushDelayedTouchEvent();