From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2F7B7821C5 for ; Sun, 19 Feb 2017 21:06:19 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Feb 2017 21:06:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,184,1484035200"; d="scan'208";a="1132212639" Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by fmsmga002.fm.intel.com with ESMTP; 19 Feb 2017 21:06:17 -0800 From: Dandan Bi To: edk2-devel@lists.01.org Cc: Eric Dong , Liming Gao Date: Mon, 20 Feb 2017 13:05:48 +0800 Message-Id: <1487567149-274444-1-git-send-email-dandan.bi@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [patch] MdeModulePkg/BMMUiLib: Remove old useless data before new save action X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Feb 2017 05:06:19 -0000 There exits the case that when saving changes in form A, the old saved data in form B are not cleaned, will be saved again with the new save. Thus incorrect UI behavior will be shown. This patch is to remove some useless data. https://bugzilla.tianocore.org/show_bug.cgi?id=385 Cc: Eric Dong Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi --- .../BootMaintenanceManagerUiLib/BootMaintenance.c | 35 +++++++++++++++++++++- .../BootMaintenanceManager.h | 14 ++++++++- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c index e49ab98..3ff23a5 100644 --- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c +++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c @@ -1,9 +1,9 @@ /** @file The functions for Boot Maintainence Main menu. -Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php @@ -1212,13 +1212,15 @@ BootMaintCallback ( if ((Value == NULL) || (ActionRequest == NULL)) { return EFI_INVALID_PARAMETER; } if (QuestionId == KEY_VALUE_SAVE_AND_EXIT_BOOT) { + CleanUselessBeforeSubmit (Private); CurrentFakeNVMap->BootOptionChanged = FALSE; *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT; } else if (QuestionId == KEY_VALUE_SAVE_AND_EXIT_DRIVER) { + CleanUselessBeforeSubmit (Private); CurrentFakeNVMap->DriverOptionChanged = FALSE; *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT; } else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT_DRIVER) { // // Discard changes and exit formset @@ -1267,10 +1269,11 @@ BootMaintCallback ( } else { switch (QuestionId) { case KEY_VALUE_SAVE_AND_EXIT: case KEY_VALUE_NO_SAVE_AND_EXIT: if (QuestionId == KEY_VALUE_SAVE_AND_EXIT) { + CleanUselessBeforeSubmit (Private); *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT; } else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT) { DiscardChangeHandler (Private, CurrentFakeNVMap); *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT; } @@ -1369,10 +1372,40 @@ DiscardChangeHandler ( break; } } /** + This function is to clean some useless data before submit changes. + + @param Private The BMM context data. + +**/ +VOID +CleanUselessBeforeSubmit ( + IN BMM_CALLBACK_DATA *Private + ) +{ + UINT16 Index; + if (Private->BmmPreviousPageId != FORM_BOOT_DEL_ID) { + for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) { + if (Private->BmmFakeNvData.BootOptionDel[Index] && !Private->BmmFakeNvData.BootOptionDelMark[Index]) { + Private->BmmFakeNvData.BootOptionDel[Index] = FALSE; + Private->BmmOldFakeNVData.BootOptionDel[Index] = FALSE; + } + } + } + if (Private->BmmPreviousPageId != FORM_DRV_DEL_ID) { + for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) { + if (Private->BmmFakeNvData.DriverOptionDel[Index] && !Private->BmmFakeNvData.DriverOptionDelMark[Index]) { + Private->BmmFakeNvData.DriverOptionDel[Index] = FALSE; + Private->BmmOldFakeNVData.DriverOptionDel[Index] = FALSE; + } + } + } +} + +/** Update the menus in the BMM page. **/ VOID diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h index 0665c78..532b75b 100644 --- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h +++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h @@ -1,9 +1,9 @@ /** @file Header file for boot maintenance module. -Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php @@ -1047,10 +1047,22 @@ VOID DiscardChangeHandler ( IN BMM_CALLBACK_DATA *Private, IN BMM_FAKE_NV_DATA *CurrentFakeNVMap ); + +/** + This function is to clean some useless data before submit changes. + + @param Private The BMM context data. + +**/ +VOID +CleanUselessBeforeSubmit ( + IN BMM_CALLBACK_DATA *Private + ); + /** Dispatch the display to the next page based on NewPageId. @param Private The BMM context data. @param NewPageId The original page ID. -- 1.9.5.msysgit.1