Skip to content
Commit 9ebb59b8 authored by Jean-Michel Trivi's avatar Jean-Michel Trivi
Browse files

Fix bug 2025765.

Talkback produced a null pointer exception when being enabled and disabled
repeatedly due to a race condition between the onDestroy() of the service,
and the use of the service itself. The error occurs when one Talkback
thread initiates the destruction of the service (call to onDestroy()) when
it invokes shutdown() on its TextToSpeech instance (the client of the
service). At the same time, Talkback tries to say that "Accessibility" is
unchecked from another thread. During onDestroy(), the reference to the
TTS engine (sNativeSynth) is reset to null, which is used in the service
in speakInternalOnly(), and setLanguage().
The fix consists in the addition of a static variable that signals that
the service has entered onDestroy(). Once this flag is set, all method
invocations on sNativeSynth will be dismissed. Note that access to the
native resources used by sNativeSynth are synchronized at the native
layer, therefore preventing sNativeSynth.shutdown() to interfere with
a sNativeSynth.speak() call already underway.
parent c134c281
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