Skip to content

Commit

Permalink
remove any screen events when menu is disposed
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Jan 11, 2024
1 parent 7373bf9 commit 2561076
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions haxe/ui/containers/menus/Menu.hx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ class MenuEvents extends haxe.ui.events.Events {
unregisterEvent(UIEvent.SHOWN, onShown);
}

public override function onDispose() {
removeScreenMouseDown();
}

private var _over:Bool = false;
private function onMouseOver(event:MouseEvent) {
_over = true;
Expand Down Expand Up @@ -232,6 +236,10 @@ class MenuEvents extends haxe.ui.events.Events {
return;
}

if (currentSubMenu._isDisposed) { // sub menu could have already been disposed of
return;
}

for (child in currentSubMenu.childComponents) {
child.removeClass(":hover", true, true);
}
Expand Down

0 comments on commit 2561076

Please sign in to comment.