MenuWidgetBase: onMenuItem() now destroys popup *after* handleMenuItemClick() to help prevent MenuItem "item" from being invalidated prematurely

This commit is contained in:
Donny Viszneki 2014-08-17 19:35:33 -07:00
parent 9f4b8e47eb
commit 1b11e24f05
1 changed files with 2 additions and 3 deletions

View File

@ -527,13 +527,12 @@ class MenuWidgetBase : ListWidget {
// copy item action listeners // copy item action listeners
Signal!MenuItemActionHandler onMenuItemActionListenerCopy = onMenuItemActionListener; Signal!MenuItemActionHandler onMenuItemActionListenerCopy = onMenuItemActionListener;
handleMenuItemClick(item);
PopupWidget popup = cast(PopupWidget)parent; PopupWidget popup = cast(PopupWidget)parent;
if (popup) if (popup)
popup.close(); popup.close();
handleMenuItemClick(item);
// this pointer now can be invalid - if popup removed // this pointer now can be invalid - if popup removed
if (onMenuItemClickListenerCopy.assigned) if (onMenuItemClickListenerCopy.assigned)
if (onMenuItemClickListenerCopy(item)) if (onMenuItemClickListenerCopy(item))