From 52672ed5e242f38fd4d99302111d00aa62468ce5 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Fri, 19 Oct 2018 08:03:07 -0400 Subject: [PATCH] More careful sorting of effects... ... when grouping by two criteria (publisher and name or type and name). Use a stable sort for the second sort so that the minor sort (done first) is sure not to be destoyed. Maybe this never mattered (depending on the implementation of std::sort and its threshold for doing small sorts by insertion). --- src/Menus.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Menus.cpp b/src/Menus.cpp index 0a7ab7ab3..9a3aebb43 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -1910,7 +1910,8 @@ void MenuCreator::PopulateEffectsMenu(CommandManager* c, comp1 = comp2 = SortEffectsByName; std::sort( defplugs.begin(), defplugs.end(), comp1 ); - std::sort( optplugs.begin(), optplugs.end(), comp2 ); + if ( comp1 != comp2 ) + std::stable_sort( optplugs.begin(), optplugs.end(), comp2 ); AddEffectMenuItems(c, defplugs, batchflags, realflags, true);