Cocoa: Fix crash on Combobox popup close.

Regression caused by 0be1c4899c.

The calls to handleCloseEvent/flushWindowSystemEvents
may result in popup window deletion and a stale/null
pointer access.

Get the window type before closing it.

Task-number: QTBUG-38418
Change-Id: I212a56979e0248076e1eb5bf9ede1ff0d424e041
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
This commit is contained in:
Morten Johan Sørvig 2014-04-23 11:32:44 +02:00 committed by The Qt Project
parent 55d1aa3121
commit 079f2bf5d8

View File

@ -637,9 +637,9 @@ static QTouchDevice *touchDevice = 0;
return [super mouseDown:theEvent];
m_sendUpAsRightButton = false;
if (m_platformWindow->m_activePopupWindow) {
Qt::WindowType type = m_platformWindow->m_activePopupWindow->type();
QWindowSystemInterface::handleCloseEvent(m_platformWindow->m_activePopupWindow);
QWindowSystemInterface::flushWindowSystemEvents();
Qt::WindowType type = m_platformWindow->m_activePopupWindow->type();
m_platformWindow->m_activePopupWindow = 0;
// Consume the mouse event when closing the popup, except for tool tips
// were it's expected that the event is processed normally.