|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Mon Dec 03, 2007 8:54 pm
[2.14a - 2.15] Local variable stringlist hashtable caching still broken :( |
Code: |
#alias blah {
whoNew = ""
#additem whoNew testA
#additem whoNew testB
// whoNew = "testA|testB"
$whoJoined = @whoNew
#FORALL {@whoList} {#DELITEM $whoJoined %i}
#VAR whoList {@whoNew}
#say whoList: @whoList
//#say whoNew: @whoNew
}
|
So, to look through the code it should create whoNew, then add testA and testB to it.
Then what should happen is it creates a local variable, $whoJoined, do some stuff to it but then do nothing with the result.
Then it should make a copy of the whoNew variable from the top and print it.
But the output isn't always testA|testB, it alternates between nothing and testA|testB
Now, the even weirder bit...
If you replace the bottom two lines of uncommented code with the commented line below it then it works consistently.
Also, if you replace the #additem lines with the commented line below it then it's consistent too
Oh, and if you remove the #FORALL line then it's also consistent, despite the #FORALL supposedly not modifying anything but the local variable
Weird! |
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Last edited by Guinn on Thu Dec 06, 2007 9:48 pm; edited 4 times in total |
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Mon Dec 03, 2007 8:58 pm |
Zugg, the email I sent you with the whoList package - it was while trying to strip the package down to basics that I got this bug, so I'm guessing hold off on the emailed package bug until this is fixed?
|
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Dec 03, 2007 10:38 pm |
This is actually the same as another bug reported with string lists and local variables.
The problem is with the way CMUD was trying to cache the hash tables for string lists. The #DELITEM was actually modifying both the $whoJoined local variable but *also* modifying the @whoList global variable used in the #FORALL. This can happen when multiple string lists contain the same values. CMUD thinks that since the string values are the same that it should use the same cached hash table, and then #DELITEM modifies the hash table that is being used.
This bug is causing several related problems. But basically, if you are using string lists and two different lists can potentially end up with the same elements, then this bug will cause all sorts of problems, including access violations (since both string lists will end up pointing to a single hash table).
I've removed my attempt to cache hash tables for the next version to fix this. |
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Thu Dec 06, 2007 9:46 pm |
This still exists in 2.15 :(
(and the XML I emailed you earlier with the wholist still crashes, incase they do turn out to be different bugs) |
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri Dec 07, 2007 5:16 pm |
Yep, I had this fixed and then it got broken again with another bug fix that I made. I think I have it fixed in v2.16 now.
|
|
|
|
|
|