Fix memory leak in EmojiPaletteView

Bug: 10902556
Change-Id: I3a8c1e08d6f953b462d914acd1f411c36f9d80f2
This commit is contained in:
Satoshi Kataoka 2013-10-08 18:54:24 +09:00
parent d900b90db7
commit 2d3e121014

View file

@ -694,13 +694,16 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
@Override @Override
public void destroyItem(final ViewGroup container, final int position, public void destroyItem(final ViewGroup container, final int position,
final Object object) { final Object object) {
ScrollKeyboardView keyboardView = mActiveKeyboardViews.get(position); final ScrollKeyboardView keyboardView = mActiveKeyboardViews.get(position);
if (keyboardView != null) { if (keyboardView != null) {
keyboardView.deallocateMemory(); keyboardView.deallocateMemory();
mActiveKeyboardViews.remove(position); mActiveKeyboardViews.remove(position);
} }
container.removeView(keyboardView); if (object instanceof View) {
keyboardView = null; container.removeView((View)object);
} else {
Log.w(TAG, "Warning!!! Emoji palette may be leaking. " + object);
}
} }
} }