Skip to content
Commit f05ce728 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Fix a reference leak in SpellCheckerSessionListenerImpl.

The primary goal of this CL is to address a reference leak
in SpellCheckerSession.SpellCheckerSessionListenerImpl if
the SpellCheckerSession is closed too early.  Here is the
minimum repro code.

  TextServicesManager tsm = (TextServicesManager)
          getSystemService(Context.TEXT_SERVICES_MANAGER_SERVICE);
  SpellCheckerSession session = tsm.newSpellCheckerSession(,
          Locale.ENGLISH, listener, false);
  session.close();

In order to make the state management reliable and easier to
debug, this CL replaces SpellCheckerSessionListenerImpl#mOpened
with an explicit state number so that we can tell three different
"not open" cases: 1) not connected yet and not closed yet, 2)
closed before establishing connection, and 3) closed after
establishing connection.

Bug: 21319642
Change-Id: Ifd05565ac0c057c46ec88a3fb9094c04934041d7
parent 100e1c92
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