Skip to content
Commit 5b734f24 authored by Mikael Gullstrand's avatar Mikael Gullstrand Committed by Johan Redestig
Browse files

Context leaks in EditText causes out of memory

In android.widget.Editor, Blink runnables can be posted even if
the related TextView is not attached to a window. If a message has
been posted to the Blink message queue and the run method of
the Blink runnable has started executing, the removeCallbacks call
in onDetachFromWindow method is not enough to abort the execution
of the Blink runnable. This results in a memory leak when
the activity is destroyed.

The solution is to cancel the execution of the Blink runnable by
calling the suspendBlink method from onDetachFromWindow method.
Hence the Blink thread will halt, and the referenced context can
be released by GC when the activity is destroyed. Also adding
a corresponding resumeBlink method call in onAttachedToWindow
to start executing the Blink runnable.

Change-Id: Icb26c9c947b3cc1158f7629ae35d7b4e42b80f17
parent 978cfc39
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