]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/BMMUiLib: Remove old useless data before new save action
authorDandan Bi <dandan.bi@intel.com>
Thu, 16 Feb 2017 10:30:20 +0000 (18:30 +0800)
committerHao Wu <hao.a.wu@intel.com>
Tue, 21 Feb 2017 11:19:22 +0000 (19:19 +0800)
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 <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c
MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h

index e49ab981a7406ab4200437253c958b8cbb412b10..3ff23a5a454592abc2f552b0093cf91eb408746a 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 The functions for Boot Maintainence Main menu.\r
 \r
-Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -1214,9 +1214,11 @@ BootMaintCallback (
     }\r
    \r
     if (QuestionId == KEY_VALUE_SAVE_AND_EXIT_BOOT) {\r
+      CleanUselessBeforeSubmit (Private);\r
       CurrentFakeNVMap->BootOptionChanged = FALSE;\r
       *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;\r
     } else if (QuestionId == KEY_VALUE_SAVE_AND_EXIT_DRIVER) {\r
+      CleanUselessBeforeSubmit (Private);\r
       CurrentFakeNVMap->DriverOptionChanged = FALSE;\r
       *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;\r
     } else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT_DRIVER) {\r
@@ -1269,6 +1271,7 @@ BootMaintCallback (
       case KEY_VALUE_SAVE_AND_EXIT:\r
       case KEY_VALUE_NO_SAVE_AND_EXIT:\r
         if (QuestionId == KEY_VALUE_SAVE_AND_EXIT) {\r
+          CleanUselessBeforeSubmit (Private);\r
           *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;\r
         } else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT) {\r
           DiscardChangeHandler (Private, CurrentFakeNVMap);\r
@@ -1370,6 +1373,36 @@ DiscardChangeHandler (
   }\r
 }\r
 \r
+/**\r
+  This function is to clean some useless data before submit changes.\r
+\r
+  @param Private            The BMM context data.\r
+\r
+**/\r
+VOID\r
+CleanUselessBeforeSubmit (\r
+  IN  BMM_CALLBACK_DATA               *Private\r
+  )\r
+{\r
+  UINT16  Index;\r
+  if (Private->BmmPreviousPageId != FORM_BOOT_DEL_ID) {\r
+    for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {\r
+      if (Private->BmmFakeNvData.BootOptionDel[Index] && !Private->BmmFakeNvData.BootOptionDelMark[Index]) {\r
+        Private->BmmFakeNvData.BootOptionDel[Index] = FALSE;\r
+        Private->BmmOldFakeNVData.BootOptionDel[Index] = FALSE;\r
+      }\r
+    }\r
+  }\r
+  if (Private->BmmPreviousPageId != FORM_DRV_DEL_ID) {\r
+    for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {\r
+      if (Private->BmmFakeNvData.DriverOptionDel[Index] && !Private->BmmFakeNvData.DriverOptionDelMark[Index]) {\r
+        Private->BmmFakeNvData.DriverOptionDel[Index] = FALSE;\r
+        Private->BmmOldFakeNVData.DriverOptionDel[Index] = FALSE;\r
+      }\r
+    }\r
+  }\r
+}\r
+\r
 /**\r
 \r
   Update the menus in the BMM page.\r
index 0665c78d79b7087657c108af616abd2b4bdff977..532b75b202133b8552b44bcc5541aa5cf4b6c9cf 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Header file for boot maintenance module.\r
 \r
-Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -1049,6 +1049,18 @@ DiscardChangeHandler (
   IN  BMM_FAKE_NV_DATA                *CurrentFakeNVMap\r
   );\r
 \r
+\r
+/**\r
+  This function is to clean some useless data before submit changes.\r
+\r
+  @param Private            The BMM context data.\r
+\r
+**/\r
+VOID\r
+CleanUselessBeforeSubmit (\r
+  IN  BMM_CALLBACK_DATA               *Private\r
+  );\r
+\r
 /**\r
   Dispatch the display to the next page based on NewPageId.\r
 \r