You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Espresso version: 2.1
What steps will reproduce the problem?
1. Use DrawerActions.openDrawer(R.id.drawer_view);
2. The activity gets destroyed (e.g. moving on to next test)
3. The activity is not GCed, it's held in memory by DrawerActions
DrawerActions.IdlingDrawerListener has an "instance" static field, and a
"parentListener" instance field. When DrawerActions.unregisterListener() is
called, it removes its own listener and replaces it with "parentListener",
however it fails to clear its reference to "parentListener".
Proposed fix:
In DrawerActions.unregisterListener(), replace this:
if (existingListener instanceof IdlingDrawerListener) {
Espresso.unregisterIdlingResources((IdlingResource) existingListener);
drawer.setDrawerListener(((IdlingDrawerListener) existingListener).parentListener);
}
with this:
if (existingListener instanceof IdlingDrawerListener) {
IdlingDrawerListener idleDrawerListener = (IdlingDrawerListener) existingListener;
Espresso.unregisterIdlingResources(idleDrawerListener);
drawer.setDrawerListener(idleDrawerListener.parentListener);
idleDrawerListener.parentListener = null;
}
Here's the chain of references:
* GC ROOT
* static
com.squareup.instrumentation.framework.DrawerActions$IdlingDrawerListener.instan
ce
* references
com.squareup.instrumentation.framework.DrawerActions$IdlingDrawerListener.parent
Listener
* references com.squareup.SomeActivity$2.this$0 (anonymous class extends
android.support.v4.widget.DrawerLayout$SimpleDrawerListener)
* leaks com.squareup.SomeActivity instance
Original issue reported on code.google.com by [email protected] on 28 Apr 2015 at 2:56
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
[email protected]
on 28 Apr 2015 at 2:56The text was updated successfully, but these errors were encountered: