Skip to content
Commit 6689c901 authored by Daniel 2 Olofsson's avatar Daniel 2 Olofsson Committed by Takeshi Aimi
Browse files

IndexOutOfBoundsException on addPreference in PreferenceGroup

IndexOutOfBoundsException thrown when attempting to add preference
to PreferenceGroup and at same time removing all preferences in list.
Issue is caused by a race condition in addPreference that retrieves
index of where to add Preference from binary search of mPreferenceList
outside of synchronized lock. If list is cleared after this point but
prior to adding preference on index returned from binarySearch
exception is thrown.

Solved by moving binarySearch to inside synchronized block. This will
allow thread safety while not impacting behavior as result from search
is only ever used from within synchronized block.

Change-Id: Ic1e7954cf977b1ddd6ddba98d4cf771f21fb4d57
parent 9d6fa062
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment