ryanmelt / qtbindings

An easy to install gem version of the Ruby bindings to Qt
http://github.com/ryanmelt/qtbindings
Other
340 stars 63 forks source link

deleting elements from a table may lead to infinite loop #110

Closed ghost closed 9 years ago

ghost commented 9 years ago

Consider the following code:

import tables

var t = initTable[int,int](4)

for i in 1..4:
  t[i] = i
  t.del(i)
t[5] = 5

Running this code gets stuck at line t[5]=5. As far as I can tell, the reason is that deleting an element with del marks the hash bucket with seDeleted, but such buckets will never be reused for new elements. Thus, inserting and deleting four elements will fill up all buckets and inserting the fifth element will fail to find a free one, causing an infinite loop in rawGetImpl.

ghost commented 9 years ago

sorry, wrong project :(