From 05c5ecd21225f173c86b92f88c65d6b9fbfb8018 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Fri, 13 Mar 2015 18:38:01 +0000
Subject: [PATCH] allow onelab enumerations with unsorted keys

---
 CMakeLists.txt       |  2 +-
 Fltk/onelabGroup.cpp | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a1ad18e545..b1215a6952 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -95,7 +95,7 @@ opt(WRAP_PYTHON "Enable generation of Python wrappers" OFF)
 
 set(GMSH_MAJOR_VERSION 2)
 set(GMSH_MINOR_VERSION 9)
-set(GMSH_PATCH_VERSION 0)
+set(GMSH_PATCH_VERSION 1)
 set(GMSH_EXTRA_VERSION "" CACHE STRING "Gmsh extra version string")
 
 set(GMSH_VERSION "${GMSH_MAJOR_VERSION}.${GMSH_MINOR_VERSION}")
diff --git a/Fltk/onelabGroup.cpp b/Fltk/onelabGroup.cpp
index a7c8514eb5..a170097481 100644
--- a/Fltk/onelabGroup.cpp
+++ b/Fltk/onelabGroup.cpp
@@ -706,10 +706,10 @@ Fl_Widget *onelabGroup::_addParameterWidget(onelab::number &p, int ww, int hh,
      p.getChoices().size() == p.getValueLabels().size()){
     Fl_Choice *but = new Fl_Choice(1, 1, ww, hh);
     std::vector<Fl_Menu_Item> menu;
+    std::vector<double> choices = p.getChoices();
     std::map<double, std::string> labels(p.getValueLabels());
-    for(std::map<double, std::string>::iterator it = labels.begin();
-        it != labels.end(); it++){
-      char *str = strdup(it->second.c_str());
+    for(unsigned int i = 0; i < choices.size(); i++){
+      char *str = strdup(labels[choices[i]].c_str());
       _treeStrings.push_back(str);
       Fl_Menu_Item menuItem = {str, 0, 0, 0, 0};
       if(highlight) menuItem.labelcolor(c);
@@ -718,8 +718,8 @@ Fl_Widget *onelabGroup::_addParameterWidget(onelab::number &p, int ww, int hh,
     Fl_Menu_Item it = {0};
     menu.push_back(it);
     but->copy(&menu[0]);
-    for(unsigned int i = 0; i < p.getChoices().size(); i++){
-      if(p.getValue() == p.getChoices()[i]){
+    for(unsigned int i = 0; i < choices.size(); i++){
+      if(p.getValue() == choices[i]){
         but->value(i);
         break;
       }
-- 
GitLab