qtquick: Fix crash when mouse receiver gets deleted
Happened when double clicking a tab
This commit is contained in:
@@ -126,6 +126,9 @@ bool TabBar_qtquick::event(QEvent *ev)
|
||||
m_tabBar->onMousePress(me->pos());
|
||||
else
|
||||
m_tabBar->onMouseDoubleClick(me->pos());
|
||||
|
||||
// Don't call base class, it might have been deleted
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -80,7 +80,14 @@ public:
|
||||
|
||||
// Finally send the event
|
||||
m_eventTarget->setProperty("cursorPosition", m_eventSource->property("cursorPosition"));
|
||||
QPointer<QObject> lifeGuard(this);
|
||||
qGuiApp->sendEvent(m_eventTarget, me);
|
||||
|
||||
if (!lifeGuard) {
|
||||
// m_eventTarget was deleted, and so was "this"
|
||||
return true;
|
||||
}
|
||||
|
||||
m_eventTarget->setProperty("cursorPosition", CursorPosition_Undefined);
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user