fixed autocompletion after change 18201 07/18207/1
Pierre-Aime Agnel [Wed, 1 Jun 2016 16:25:54 +0000 (18:25 +0200)]
the merge https://codereview.scilab.org/#/c/18201/2 caused completion to crash scilab

Change-Id: If06b1728b9ceabb71185b018b2e4dba825106309

scilab/modules/completion/src/c/completion.c

index d669157..d968bf1 100644 (file)
@@ -274,7 +274,11 @@ char **completionOnVariablesWithoutMacros(const char *somechars, int *sizeArrayR
         }
         else
         {
-            ListWords = dictionaryVariables;
+            ListWords = (char**)MALLOC(sizeof(char*) * (sizedictionaryVariables + 1));
+            for ( i = 0; i < sizedictionaryVariables; i++ )
+            {
+                ListWords[i] = os_strdup(dictionaryVariables[i]);
+            }
             *sizeArrayReturned = sizedictionaryVariables;
         }