fix crash on nested popup closing

This commit is contained in:
Vadim Lopatin 2014-05-07 16:45:57 +04:00
parent ba9ce609a4
commit e0c9b8bc9c
1 changed files with 15 additions and 8 deletions

View File

@ -270,14 +270,21 @@ class MenuWidgetBase : ListWidget {
} }
protected void onPopupClosed(PopupWidget p) { protected void onPopupClosed(PopupWidget p) {
bool undoSelection = _openedPopupIndex == _selectedItemIndex; if (_openedPopup) {
_openedPopup = null; if (_openedPopup is p) {
_openedMenu = null; _openedMenu.onPopupClosed(p);
if (undoSelection) { bool undoSelection = _openedPopupIndex == _selectedItemIndex;
selectItem(-1); _openedPopup = null;
setHoverItem(-1); _openedMenu = null;
} if (undoSelection) {
window.setFocus(this); selectItem(-1);
setHoverItem(-1);
}
window.setFocus(this);
} else if (thisPopup is p) {
_openedPopup.close();
}
}
} }
protected void openSubmenu(int index, MenuItemWidget itemWidget, bool selectFirstItem) { protected void openSubmenu(int index, MenuItemWidget itemWidget, bool selectFirstItem) {