Patch #2876 2009-12-27 18:42

techy

Global variable dialog array access fixes (debug4)
Download
2876-Global_variabl.patch (924 bytes)
Category
Application::Bugfix
Status
Accepted
Close date
2009-12-31 14:53
Assigned to
mortenmacfly
Index: src/sdk/uservarmanager.cpp
===================================================================
--- src/sdk/uservarmanager.cpp    (revision 5986)
+++ src/sdk/uservarmanager.cpp    (working copy)
@@ -541,7 +541,10 @@
     for(unsigned int i = 0; i < builtinMembers.GetCount(); ++i)
     {
         ((wxTextCtrl*) FindWindow(builtinMembers[i]))->SetValue(cfg->Read(path + builtinMembers[i]));
-        knownMembers.RemoveAt(knownMembers.Index(builtinMembers[i], false));
+        
+        int index = knownMembers.Index(builtinMembers[i], false);
+        if (index != wxNOT_FOUND)
+            knownMembers.RemoveAt(index);
     }
 
     for(unsigned int i = 0; i < 7; ++i)
@@ -608,8 +611,7 @@
     selVar->Clear();
     selVar->Append(vars);
 
-
-    if(currentVar.IsEmpty())
+    if(currentVar.IsEmpty() && selVar->GetCount() > 0)
         currentVar = selVar->GetString(0);
 
     selSet->SetStringSelection(currentSet);
techy 2009-12-27 18:44

Under some conditions global variable dialogue uses invalid indexes - fixed by this patch.

mortenmacfly 2009-12-28 19:29

Question here: Why did you disable the case _in_sensitivity (the "false" attribute when accessing the index)?

techy 2009-12-28 23:51

Ah, sorry, I thought that it was searchFromEnd as in Index() of wxArray, which defaults to false so I thought it was unnecessary. Thanks for spotting this. Uploading fixed version.