Skip to content

Commit

Permalink
Merge pull request emilsjolander#353 from seato/seato/issue-352-memor…
Browse files Browse the repository at this point in the history
…y-leaks

Issue 352: Clean up some memory leaks originating in the adapter's deleg...
  • Loading branch information
emilsjolander committed Apr 6, 2015
2 parents 168bbd5 + 89141f2 commit c308473
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ interface OnHeaderClickListener {
void onHeaderClick(View header, int itemPosition, long headerId);
}

final StickyListHeadersAdapter mDelegate;
StickyListHeadersAdapter mDelegate;
private final List<View> mHeaderCache = new LinkedList<View>();
private final Context mContext;
private Drawable mDivider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class SectionIndexerAdapterWrapper extends
AdapterWrapper implements SectionIndexer {

final SectionIndexer mSectionIndexerDelegate;
SectionIndexer mSectionIndexerDelegate;

SectionIndexerAdapterWrapper(Context context,
StickyListHeadersAdapter delegate) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,12 @@ private boolean requireSdkVersion(int versionCode) {

public void setAdapter(StickyListHeadersAdapter adapter) {
if (adapter == null) {
if (mAdapter instanceof SectionIndexerAdapterWrapper) {
((SectionIndexerAdapterWrapper) mAdapter).mSectionIndexerDelegate = null;
}
if (mAdapter != null) {
mAdapter.mDelegate = null;
}
mList.setAdapter(null);
clearHeader();
return;
Expand Down

0 comments on commit c308473

Please sign in to comment.