mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 07:13:00 +00:00 
			
		
		
		
	Merge pull request #10394 from TeamNewPipe/fix/memory-leaks
Fix memory leaks and add documentation
This commit is contained in:
		| @@ -80,9 +80,29 @@ public abstract class BaseFragment extends Fragment { | |||||||
|     // Init |     // Init | ||||||
|     //////////////////////////////////////////////////////////////////////////*/ |     //////////////////////////////////////////////////////////////////////////*/ | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * This method is called in {@link #onViewCreated(View, Bundle)} to initialize the views. | ||||||
|  |      * | ||||||
|  |      * <p> | ||||||
|  |      * {@link #initListeners()} is called after this method to initialize the corresponding | ||||||
|  |      * listeners. | ||||||
|  |      * </p> | ||||||
|  |      * @param rootView The inflated view for this fragment | ||||||
|  |      *                 (provided by {@link #onViewCreated(View, Bundle)}) | ||||||
|  |      * @param savedInstanceState The saved state of this fragment | ||||||
|  |  *                               (provided by {@link #onViewCreated(View, Bundle)}) | ||||||
|  |      */ | ||||||
|     protected void initViews(final View rootView, final Bundle savedInstanceState) { |     protected void initViews(final View rootView, final Bundle savedInstanceState) { | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Initialize the listeners for this fragment. | ||||||
|  |      * | ||||||
|  |      * <p> | ||||||
|  |      * This method is called after {@link #initViews(View, Bundle)} | ||||||
|  |      * in {@link #onViewCreated(View, Bundle)}. | ||||||
|  |      * </p> | ||||||
|  |      */ | ||||||
|     protected void initListeners() { |     protected void initListeners() { | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -80,6 +80,8 @@ public abstract class BaseStateFragment<I> extends BaseFragment implements ViewC | |||||||
|         if (errorPanelHelper != null) { |         if (errorPanelHelper != null) { | ||||||
|             errorPanelHelper.dispose(); |             errorPanelHelper.dispose(); | ||||||
|         } |         } | ||||||
|  |         emptyStateView = null; | ||||||
|  |         emptyStateMessageView = null; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     protected void onRetryButtonClicked() { |     protected void onRetryButtonClicked() { | ||||||
|   | |||||||
| @@ -139,6 +139,12 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     @Override | ||||||
|  |     public void onDestroyView() { | ||||||
|  |         super.onDestroyView(); | ||||||
|  |         binding = null; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /*////////////////////////////////////////////////////////////////////////// |     /*////////////////////////////////////////////////////////////////////////// | ||||||
|     // Menu |     // Menu | ||||||
|     //////////////////////////////////////////////////////////////////////////*/ |     //////////////////////////////////////////////////////////////////////////*/ | ||||||
|   | |||||||
| @@ -115,6 +115,11 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() { | |||||||
|         feedGroupsCarouselState = feedGroupsCarousel.onSaveInstanceState() |         feedGroupsCarouselState = feedGroupsCarousel.onSaveInstanceState() | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     override fun onDestroyView() { | ||||||
|  |         super.onDestroyView() | ||||||
|  |         _binding = null | ||||||
|  |     } | ||||||
|  |  | ||||||
|     override fun onDestroy() { |     override fun onDestroy() { | ||||||
|         super.onDestroy() |         super.onDestroy() | ||||||
|         disposables.dispose() |         disposables.dispose() | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Stypox
					Stypox