-
-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Method: onCreateView() in BottomSheetMenuFragment.java
Description:
Click listeners registered in onCreateView() are not properly removed in onDestroyView(), causing memory leaks when the fragment is recreated multiple times.
Steps to Reproduce:
- Open the bottom sheet menu multiple times
- Close and reopen the fragment repeatedly
- Monitor memory usage (increases over time)
Expected Behavior:
Listeners should be cleaned up when fragment is destroyed to prevent memory leaks.
Actual Behavior:
Listeners remain in memory, causing gradual memory accumulation and potential OutOfMemory errors.
Proposed Fix
Clear click listeners before nullifying the binding in onDestroyView():
@Override
public void onDestroyView() {
super.onDestroyView();
if (binding != null) {
binding.menuSettings.setOnClickListener(null);
binding.menuHelpFeedback.setOnClickListener(null);
binding.menuUpdates.setOnClickListener(null);
binding.menuShare.setOnClickListener(null);
binding = null;
}
}Metadata
Metadata
Assignees
Labels
No labels