daniel-stoneuk / material-about-library

Makes it easy to create beautiful about screens for your apps
Apache License 2.0
1.12k stars 140 forks source link

Memory Leak when using ConvenienceBuilder.createAppTitleItem() #74

Closed code-schreiber closed 6 years ago

code-schreiber commented 6 years ago

It seems when passing context to ConvenienceBuilder.createAppTitleItem() the activity instance is leaked.

Code to reproduce
    @NonNull
    @Override
    protected MaterialAboutList getMaterialAboutList(@NonNull Context context) {
        MaterialAboutCard card = new MaterialAboutCard.Builder()
                .addItem(ConvenienceBuilder.createAppTitleItem(context)) // This leaks the activity
                .build();

        return new MaterialAboutList.Builder()
                .addCard(card)
                .build();
    }
Leakcanary says

screenshot_1518513424

Now, from what I understand about it is this a known leak and affects JELLY_BEANup to MARSHMALLOW.

The way to easily avoid it in ConvenienceBuilder would be to pass the application context and not the activity directly.

daniel-stoneuk commented 6 years ago

Merged! Thank you.

code-schreiber commented 6 years ago

You are very welcome 😀