XPopup icon indicating copy to clipboard operation
XPopup copied to clipboard

KeyboardUtils内存泄漏

Open hehen opened this issue 3 years ago • 2 comments

XPopup版本 如2.8.15

手机系统和型号 小米10 Android 12

描述你的问题 使用方法autoOpenSoftInput(true)时KeyboardUtils内存泄漏

├─ android.os.ResultReceiver$MyResultReceiver instance
│    Leaking: UNKNOWN
│    Retaining 2.6 MB in 57145 objects
│    ↓ ResultReceiver$MyResultReceiver.this$0
│                                      ~~~~~~
├─ com.lxj.xpopup.util.KeyboardUtils$SoftInputReceiver instance
│    Leaking: UNKNOWN
│    Retaining 2.6 MB in 57144 objects
│    context instance of com.syds.platform.activity.TicketFireSafeActivity with mDestroyed = true
│    ↓ KeyboardUtils$SoftInputReceiver.context

可能是以下原因造成的: public static void showSoftInput(final View view) { if(view==null) return; InputMethodManager imm = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);; if (imm == null) return; view.setFocusable(true); view.setFocusableInTouchMode(true); view.requestFocus(); imm.showSoftInput(view, 0 ,new SoftInputReceiver(view.getContext()));//这里使用view.getContext()可能会造成内存泄漏 imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); }

hehen avatar Aug 19 '22 02:08 hehen

@hehen 更新到最新版本试试

junixapp avatar Nov 23 '22 06:11 junixapp

你用的什么工具检测的内存泄漏 ,看着挺高大上呢

billdizl avatar Jan 09 '23 09:01 billdizl