diff options
author | Joerg Bornemann <joerg.bornemann@trolltech.com> | 2009-05-25 14:26:13 (GMT) |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@trolltech.com> | 2009-05-25 14:39:13 (GMT) |
commit | 3d560a498803fadfec9163d7a9695aee60cca8d4 (patch) | |
tree | cbfa2f56d448d0de3cd55ed57705ef0d998b6cb0 /src | |
parent | 9021113c583cc6b54b3b764e8e74d1448474c773 (diff) | |
download | Qt-3d560a498803fadfec9163d7a9695aee60cca8d4.zip Qt-3d560a498803fadfec9163d7a9695aee60cca8d4.tar.gz Qt-3d560a498803fadfec9163d7a9695aee60cca8d4.tar.bz2 |
BT: fix systray balloon crash bug on Windows CE
Its the context menu handling code... again.
Problem is, that during execution of translateMouseEvent, the widget
is closed and a modal message box is shown. After that, there's no
widget at globalPos and thus, alienWidget is null.
This patch just adds a null check for alienWidget.
Task-number: 254425
Reviewed-by: mauricek
BT: yes
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qapplication_win.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index f14ad6f..239ee14 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -1675,20 +1675,23 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam // send the context menu event is a different one if (!alienWidget->testAttribute(Qt::WA_NativeWindow) && !alienWidget->testAttribute(Qt::WA_PaintOnScreen)) { alienWidget = QApplication::widgetAt(globalPos); - pos = alienWidget->mapFromGlobal(globalPos); + if (alienWidget) + pos = alienWidget->mapFromGlobal(globalPos); } - SHRGINFO shrg; - shrg.cbSize = sizeof(shrg); - shrg.hwndClient = hwnd; - shrg.ptDown.x = GET_X_LPARAM(lParam); - shrg.ptDown.y = GET_Y_LPARAM(lParam); - shrg.dwFlags = SHRG_RETURNCMD | SHRG_NOANIMATION; - resolveAygLibs(); - if (ptrRecognizeGesture && (ptrRecognizeGesture(&shrg) == GN_CONTEXTMENU)) { - if (qApp->activePopupWidget()) - qApp->activePopupWidget()->close(); - QContextMenuEvent e(QContextMenuEvent::Mouse, pos, globalPos); - result = qt_sendSpontaneousEvent(alienWidget, &e); + if (alienWidget) { + SHRGINFO shrg; + shrg.cbSize = sizeof(shrg); + shrg.hwndClient = hwnd; + shrg.ptDown.x = GET_X_LPARAM(lParam); + shrg.ptDown.y = GET_Y_LPARAM(lParam); + shrg.dwFlags = SHRG_RETURNCMD | SHRG_NOANIMATION; + resolveAygLibs(); + if (ptrRecognizeGesture && (ptrRecognizeGesture(&shrg) == GN_CONTEXTMENU)) { + if (qApp->activePopupWidget()) + qApp->activePopupWidget()->close(); + QContextMenuEvent e(QContextMenuEvent::Mouse, pos, globalPos); + result = qt_sendSpontaneousEvent(alienWidget, &e); + } } } } |