From 4bf488b544f975f849353eba7741675fa1ed5f98 Mon Sep 17 00:00:00 2001 From: David Erceg Date: Fri, 20 Dec 2024 01:23:56 +1100 Subject: [PATCH] Fix issue with building "Bookmarks" menu When building the "Bookmarks" menu, the items under the "Bookmarks Menu" folder are inserted first, followed by the items in the "Other Bookmarks" folder. A nextMenuId field is used to keep track of the next available menu item ID. Previously, that field wasn't being initialized, which meant that if there were no "Bookmarks Menu" items, the field would never be set. When inserting the "Other Bookmarks" items, the uninitialized field would be used. Depending on the exact value of the field, no items might be added (if the value was above the assigned range), or items might be added, but not respond correctly when selected. To fix this, the nextMenuId field is now initialized when building the menu. --- Documentation/User/History.txt | 3 +++ Explorer++/Explorer++/Bookmarks/UI/BookmarksMainMenu.cpp | 1 + 2 files changed, 4 insertions(+) diff --git a/Documentation/User/History.txt b/Documentation/User/History.txt index 5f3cd94ee..e29fc8a5f 100644 --- a/Documentation/User/History.txt +++ b/Documentation/User/History.txt @@ -131,6 +131,9 @@ Bug fixes: appear on the bookmarks toolbar, if the toolbar was initially empty. The height of the toolbar is now updated when an item is added, which fixes this issue. +- If the only bookmarks that appeared in the "Bookmarks" menu + were under the "Other Bookmarks" folder, the menu wouldn't be + built correctly. - Fixed an issue with handling the properties item on the background context menu. - Previously, listview groups were always sorted by name. Now, diff --git a/Explorer++/Explorer++/Bookmarks/UI/BookmarksMainMenu.cpp b/Explorer++/Explorer++/Bookmarks/UI/BookmarksMainMenu.cpp index dbb8875b2..303361d59 100644 --- a/Explorer++/Explorer++/Bookmarks/UI/BookmarksMainMenu.cpp +++ b/Explorer++/Explorer++/Bookmarks/UI/BookmarksMainMenu.cpp @@ -52,6 +52,7 @@ void BookmarksMainMenu::OnMainMenuPreShow(HMENU mainMenu) { std::vector menuImages; BookmarkMenuBuilder::MenuInfo menuInfo; + menuInfo.nextMenuId = m_menuIdRange.startId; auto bookmarksMenu = BuildMainBookmarksMenu(menuImages, menuInfo); MENUITEMINFO mii;