Heads up: WebListBox RowTagAt doesn't return right value sometimes!

Seems like Xojo uses some dictionary (or something else) with Hash function to find the RowTag values.

But if two values have same hash, you get back the wrong one!

Reported as feedback case 63257.

4 Likes

Christian,

We don’t use a hash. They’re stored based on the primary key provided by the underlying data source. If you don’t provide your own data source (you use addrow to populate your listbox), one is created for you and the primary keys are the original row ids.

I am happy to look at your case, but please don’t guess at what we’re doing and then use that as the factual explanation of why it is failing.

Of course I don’t know what you guys to internally, but we can see that you use a dictionary there and my second project for the bug case shows that two entries get same hashes. We find the one in the array of hashes.

And your code managing the RowTag seems to use a dictionary with hashes.

+                       ! : 3 WebListBox._DSTagAdd%s%o<WebListBox>v  (in OutSideII.debug) + 341  [0x100364805]
+                       ! : | 3 Dictionary.HasKey%b%o<Dictionary>v  (in OutSideII.debug) + 15  [0x1002071ff]
+                       ! : |   3 dictionaryHasKey  (in rbframework.dylib) + 29  [0x1009e2741]
+                       ! : |     3 Dictionary::GetValue(VariantObject*)  (in rbframework.dylib) + 113  [0x1009e1af3]
+                       ! : |       3 Dictionary::FindByHash(unsigned long, VariantObject*)  (in rbframework.dylib) + 63  [0x1009e1a45]

Please improve it, so RowTag values don’t need to be unique or hash to unique values.

2 Likes

Yes, but the keys are the Integer Primary Keys

Please do not use my RowTag values as your primary key.
I want to be free to stuff anything in the row tags.

I didn’t say we were using rowtags.

Did you reproduce the issue?

I don’t have source code to look into. I just see from outside, that the WebListbox mixes values with same variant.hash. That may be a coincidence or you somewhere cache values by hashes.

Anyway, I look forward to a fix in the next beta to test as I think the Listbox is a core feature and should properly keep the values we put in.

3 Likes

Christian, are you sorting? See WebListbox.CellAt doesn't function after listbox has been sorted

As you see in the example project, there is no sorting.