Repository navigation
Clear keeps the copy-on-write mode - #594
shounakjoshi88-a11y wants to merge 1 commit into
Conversation
Clear emptied the bitmap and reset copyOnWrite to false, so a bitmap that the user had put in copy-on-write mode silently lost that mode across a Clear, and its next mutation ran with sharing off. The flag is a mode the user selects with SetCopyOnWrite, not part of the contents; self-Xor and self-AndNot route through Clear too, and a result bitmap keeps its mode there as well.
|
Hi - the workflows on this pull request are waiting for approval to run (a fork pull request needs a maintainer to approve the first run). Could someone approve them when convenient? Everything is green locally:
|
|
Thanks for the report. We're keeping |
|
Understood, thanks for the explanation - |
Why
roaringArray.clear()didresize(0)and resetcopyOnWrite = false.Bitmap.Clear()routes through it, so a bitmap the caller had put in copy-on-write mode withSetCopyOnWrite(true)silently lost that mode onClear— and its next mutation then ran with sharing off, which is exactly what the mode exists to prevent:The other two callers of
Clear()—XorandAndNoton a bitmap with itself (rb == x2) — route throughClearas well, and a result bitmap should keep its mode there too.What
roaringArray.clear()only resizes to zero;copyOnWriteis a mode the user selects, not part of the contents, so it survivesClear. It is still reverted bySetCopyOnWrite(false).TestClearKeepsCopyOnWritepins it:GetCopyOnWrite()staystrueafterClearon a copy-on-write bitmap (andfalseafterClearon one without), and the bitmap is still usable and valid after the nextAdd.The full package is green,
gofmt/go vetclean on the two touched files. The test fails onmainwithout the one-line fix.