From a42e375798dbc1d7b97b4dcca643f13150f368c9 Mon Sep 17 00:00:00 2001 From: Billy Brawner Date: Wed, 29 Nov 2017 08:33:45 -0600 Subject: [PATCH] Fix memory leak in PreviewFragment --- .../simplemarkdown/view/fragment/PreviewFragment.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/wbrawner/simplemarkdown/view/fragment/PreviewFragment.java b/app/src/main/java/com/wbrawner/simplemarkdown/view/fragment/PreviewFragment.java index 4b1a461..d66796f 100644 --- a/app/src/main/java/com/wbrawner/simplemarkdown/view/fragment/PreviewFragment.java +++ b/app/src/main/java/com/wbrawner/simplemarkdown/view/fragment/PreviewFragment.java @@ -71,8 +71,12 @@ public class PreviewFragment extends Fragment implements MarkdownPreviewView { @Override public void onDestroyView() { - super.onDestroyView(); + if (markdownPreview != null) { + ((ViewGroup) markdownPreview.getParent()).removeView(markdownPreview); + markdownPreview.destroy(); + } unbinder.unbind(); + super.onDestroyView(); } @Override