Closed Bug 1445403 Opened 7 years ago Closed 7 years ago

FocusState isn't really threadsafe

Categories

(Core :: Panning and Zooming, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla61
Tracking Status
firefox61 --- fixed

People

(Reporter: kats, Assigned: kats)

References

Details

Attachments

(3 files)

FocusState is owned by APZCTreeManager, but is touched from both the controller and sampler threads. As an example, the Update method is called on the sampler thread at [1], while the ReceiveFocusChangingEvent is called on the controller thread at [2]. There is no locking in FocusState, so there are potentially race conditions and other failures that can result. Given that FocusState is pretty well self-contained it's probably simplest to just add a Mutex and ensure all the methods hold the mutex. [1] https://searchfox.org/mozilla-central/rev/99df6dad057b94c2ac4d8b12f7b0b3a7fdf25d04/gfx/layers/apz/src/APZCTreeManager.cpp#475,481 [2] https://searchfox.org/mozilla-central/rev/99df6dad057b94c2ac4d8b12f7b0b3a7fdf25d04/gfx/layers/apz/src/APZCTreeManager.cpp#1866
Comment on attachment 8958787 [details] Bug 1445403 - Move FocusState method implementations into .cpp file. https://reviewboard.mozilla.org/r/227696/#review233470
Attachment #8958787 - Flags: review?(rhunt) → review+
Comment on attachment 8958788 [details] Bug 1445403 - Sprinkle some magical Mutex dust on FocusState. https://reviewboard.mozilla.org/r/227698/#review233474 Nice, I like the compile time proof in IsCurrent().
Attachment #8958788 - Flags: review?(rhunt) → review+
Attachment #8958789 - Flags: review?(rhunt) → review+
Pushed by kgupta@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d2252a254712 Move FocusState method implementations into .cpp file. r=rhunt https://hg.mozilla.org/integration/autoland/rev/76ecb95e795f Sprinkle some magical Mutex dust on FocusState. r=rhunt https://hg.mozilla.org/integration/autoland/rev/4c417b678b5d Add thread assertions as documentation. r=rhunt
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: