Bug 834414 - Remove a dangling reference to the LayerView in the IME code when the activity is destroyed. r=jchen

This commit is contained in:
Kartikaya Gupta 2013-01-25 13:51:41 -05:00
parent 8a2bf5b9c8
commit 6e4510693c
2 changed files with 7 additions and 7 deletions

View File

@ -1569,6 +1569,8 @@ abstract public class GeckoApp
LayerView layerView = (LayerView) findViewById(R.id.layer_view);
layerView.initializeView(GeckoAppShell.getEventDispatcher());
mLayerView = layerView;
// bind the GeckoEditable instance to the new LayerView
GeckoAppShell.notifyIMEEnabled(GeckoEditableListener.IME_STATE_DISABLED, "", "", "", false);
}
}

View File

@ -77,9 +77,9 @@ final class GeckoEditable
private final SpannableStringBuilder mText;
private final SpannableStringBuilder mChangedText;
private final Editable mProxy;
private final GeckoEditableListener mListener;
private final ActionQueue mActionQueue;
private GeckoEditableListener mListener;
private int mSavedSelectionStart;
private volatile int mGeckoUpdateSeqno;
private int mUIUpdateSeqno;
@ -545,10 +545,8 @@ final class GeckoEditable
@Override
public void notifyIMEEnabled(final int state, final String typeHint,
final String modeHint, final String actionHint) {
if (DEBUG) {
// GeckoEditableListener methods should all be called from the Gecko thread
GeckoApp.assertOnGeckoThread();
}
// Because we want to be able to bind GeckoEditable to the newest LayerView instance,
// this can be called from the Java UI thread in addition to the Gecko thread.
geckoPostToUI(new Runnable() {
public void run() {
// Make sure there are no other things going on
@ -558,10 +556,10 @@ final class GeckoEditable
// InputConnectionHandler.onCreateInputConnection
LayerView v = GeckoApp.mAppContext.getLayerView();
if (v != null) {
mListener = GeckoInputConnection.create(v, GeckoEditable.this);
v.setInputConnectionHandler((InputConnectionHandler)mListener);
mListener.notifyIMEEnabled(state, typeHint, modeHint, actionHint);
}
mListener.notifyIMEEnabled(state, typeHint,
modeHint, actionHint);
}
});
}