MutableDict vs. SharedKeys
Closed this issue · 0 comments
snej commented
Mutable collections don't play well with SharedKeys:
-
Dict::get(int)
andDict::get(key&)
don't check whether the instance is mutable, so they look through the (nonexistent) Dict data and get garbage, likely causing a crash. -
HeapDict::iterator
assumes that its key map and the source Dict's iterator are both sorted the same way. However, with SharedKeys this isn't true: in the source Dict, integer keys come before non-integers and are sorted by int value not string value. This confuses the iterator and it'll return the wrong data.
The fix is probably to make HeapDict support integer keys when its source has SharedKeys.