From 8a3d3a147665bd26e680ac29a18e82416bc61bde Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Henrotte?= <francois.henrotte@uclouvain.be>
Date: Wed, 18 Oct 2017 13:26:19 +0200
Subject: [PATCH] fix readOnly logic so that the server value is correctly
 considered when updating a parameter

---
 Common/GmshMessage.cpp | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/Common/GmshMessage.cpp b/Common/GmshMessage.cpp
index 513bb2dbc3..a07efdbf03 100644
--- a/Common/GmshMessage.cpp
+++ b/Common/GmshMessage.cpp
@@ -1269,8 +1269,10 @@ void Msg::ExchangeOnelabParameter(const std::string &key,
   bool noRange = true, noChoices = true, noLoop = true;
   bool noGraph = true, noClosed = true;
   if(ps.size()){
-    if(fopt.count("ReadOnly") && fopt["ReadOnly"][0])
-      ps[0].setValues(val); // use local value
+    bool useLocalValue = ps[0].getReadOnly();
+    if(fopt.count("ReadOnly")) useLocalValue = fopt["ReadOnly"][0];
+    if(useLocalValue){
+      ps[0].setValues(val);
     else
       val = ps[0].getValues(); // use value from server
     // keep track of these attributes, which can be changed server-side (unless
@@ -1373,7 +1375,9 @@ void Msg::ExchangeOnelabParameter(const std::string &key,
   _onelabClient->get(ps, name);
   bool noChoices = true, noClosed = true, noMultipleSelection = true;
   if(ps.size()){
-    if(fopt.count("ReadOnly") && fopt["ReadOnly"][0])
+    bool useLocalValue = ps[0].getReadOnly();
+    if(fopt.count("ReadOnly")) useLocalValue = fopt["ReadOnly"][0];
+    if(useLocalValue){
       ps[0].setValue(val); // use local value
     else
       val = ps[0].getValue(); // use value from server
-- 
GitLab