Skip to content

Commit

Permalink
Merge pull request square#237 from ErikHellman/master
Browse files Browse the repository at this point in the history
Protect DisplayLeakActivity.setTheme() from receiving an incompatible theme
  • Loading branch information
pyricau committed Sep 2, 2015
2 parents 35dd5ea + e7d56a7 commit 2da80d7
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;

import com.squareup.leakcanary.AnalysisResult;
import com.squareup.leakcanary.HeapDump;
import com.squareup.leakcanary.R;

import java.io.File;
import java.io.FileInputStream;
import java.io.FilenameFilter;
Expand Down Expand Up @@ -129,6 +131,17 @@ public static PendingIntent createPendingIntent(Context context, String referenc
LoadLeaks.load(this);
}

@Override
public void setTheme(int resid) {
// We don't want this to be called with an incompatible theme.
// This could happen if you implement runtime switching of themes
// using ActivityLifecycleCallbacks.
if (resid != R.style.leak_canary_LeakCanary_Base) {
return;
}
super.setTheme(resid);
}

@Override protected void onDestroy() {
super.onDestroy();
LoadLeaks.forgetActivity();
Expand Down

0 comments on commit 2da80d7

Please sign in to comment.