From 8e45d1fbd6c96313bc024b9a1bad9bc60419dd45 Mon Sep 17 00:00:00 2001 From: Imanol Fernandez Date: Thu, 7 Nov 2019 22:26:58 +0100 Subject: [PATCH] Fix context menu still displayed after clicking the clear button (#2193) --- .../vrbrowser/ui/widgets/WindowWidget.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/WindowWidget.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/WindowWidget.java index b5dc5731f..eeacc6006 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/WindowWidget.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/WindowWidget.java @@ -309,7 +309,7 @@ public void onResume() { public void close() { TelemetryWrapper.closeWindowEvent(mWindowId); - + hideContextMenus(); releaseWidget(); mBookmarksView.onDestroy(); mHistoryView.onDestroy(); @@ -1429,14 +1429,22 @@ public void onFxASynSettings(@NonNull View view) { private void hideContextMenus() { if (mContextMenu != null) { - mContextMenu.hide(REMOVE_WIDGET); - mContextMenu.releaseWidget(); + if (!mContextMenu.isReleased()) { + if (mContextMenu.isVisible()) { + mContextMenu.hide(REMOVE_WIDGET); + } + mContextMenu.releaseWidget(); + } mContextMenu = null; } if (mSelectionMenu != null) { mSelectionMenu.setDelegate((SelectionActionWidget.Delegate)null); - mSelectionMenu.hide(REMOVE_WIDGET); - mSelectionMenu.releaseWidget(); + if (!mSelectionMenu.isReleased()) { + if (mSelectionMenu.isVisible()) { + mSelectionMenu.hide(REMOVE_WIDGET); + } + mSelectionMenu.releaseWidget(); + } mSelectionMenu = null; } @@ -1445,7 +1453,8 @@ private void hideContextMenus() { mWidgetManager.updateWidget(this); } - if (mLibraryItemContextMenu != null && mLibraryItemContextMenu.isVisible()) { + if (mLibraryItemContextMenu != null && !mLibraryItemContextMenu.isReleased() + && mLibraryItemContextMenu.isVisible()) { mLibraryItemContextMenu.hide(REMOVE_WIDGET); } }