Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

Fix memory leak #210

Merged
merged 2 commits into from
Jun 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dexter/src/main/java/com/karumi/dexter/DexterInstance.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ void onActivityReady(Activity activity) {
*/
void onActivityDestroyed() {
isRequestingPermission.set(false);
listener = EMPTY_LISTENER;
}

/**
Expand Down Expand Up @@ -322,6 +323,7 @@ private void checkMultiplePermissions(final MultiplePermissionsListener listener
}
isRequestingPermission.set(false);
listener.onPermissionsChecked(report);
DexterInstance.this.listener = EMPTY_LISTENER;
}
});
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public void onCheckPermissionMoreThanOnceThenThrowException() {
}

@Test public void onPermissionFailedByRuntimeExceptionThenNotifiesListener() {
givenPermissionIsChecked(ANY_PERMISSION, PackageManager.PERMISSION_DENIED);
givenARuntimeExceptionIsThrownWhenPermissionIsChecked(ANY_PERMISSION);
givenShouldShowRationaleForPermission(ANY_PERMISSION);

Expand Down
1 change: 1 addition & 0 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ dependencies {
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.jakewharton:butterknife:8.6.0'
implementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
implementation project(':dexter')
androidTestImplementation 'com.android.support.test:runner:0.5'
Expand Down
1 change: 1 addition & 0 deletions sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<uses-permission android:name="android.permission.RECORD_AUDIO"/>

<application
android:name=".SampleApplication"
android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_logo_karumi"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.karumi.dexter.sample;

import android.app.Application;
import com.squareup.leakcanary.LeakCanary;

public class SampleApplication extends Application {

@Override public void onCreate() {
super.onCreate();
configureLeakCanary();
}

private void configureLeakCanary() {
if (LeakCanary.isInAnalyzerProcess(this)) {
return;
}
LeakCanary.install(this);
}
}