Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

KeyManager::decrementAndMaybeRemoveKey crashes in case if traversal completion was performed after Activity destroy #194

Open
novachevskyi opened this issue Aug 2, 2016 · 1 comment

Comments

@novachevskyi
Copy link
Contributor

I observed this crash when I was working on screen transition animation logic setup on top of the Flow. After enabling Don't keep activities developer option in device settings, I tried to minimize application during transition animation and crash has occurred.

In my case I placed TraversalCallback::onTraversalCompleted method call inside of transition animation completion callback. This callback was fired after activity was destroyed and because of that node instance inside of KeyManager::decrementAndMaybeRemoveKey was null. So I received NPE when library was trying to access ManagedServices::uses field on a null value object instance.

The easiest fix that I've found for this issue is just to add null check for node variable inside of KeyManager::decrementAndMaybeRemoveKey method body: if(node == null) { return false; }.

Please let me know if I'm missing something here or if some other solution should be applied to fix this issue. I will appreciate for your help.

@loganj
Copy link
Collaborator

loganj commented Sep 2, 2016

This seems like an animation/lifecycle bug in the app. I think the animation should probably have been canceled when the activity paused, and your animation handler should have immediately completed the traversal.

I'm hesitant to add a null check because that could hide bugs (including this?).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants