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
view inflation starts and lots of views are inflated, their presenters' takeView
and onLoad methods are called
Android senses a configuration change and never attaches those views
so their onDetachedFromWindow methods are not called
so their Presenters' dropView methods are not called
the outgoing activity does call dropView for its own presenters
A new activity starts, finds the existing activity scope and calls its onCreate method,
before it calls takeView on its own presenters
it tells previously registered bundlers to onLoad
some of them are in presenters that still have views from the old config, so
they go ahead and call presenter onLoad
So now we have child presenters trying to load, and possibly asking their ancestor presenters to do stuff while the ancestors' views are still null. Crashes ensue.
@dnkoutso and I are pretty certain that the fix is simple: make presenters debounce their onLoad calls. It's already the case that Presenter#onLoad will not be called until takeView has been received. We should go further and make certain that onLoad will be called exactly once for any View instance.
We haven't thought yet of anything that this will break, and can think of lots of things that it will fix.
The text was updated successfully, but these errors were encountered:
This also has the beneficial effect of making it much easier to work with observables - I was getting double subscribes in onLoad, which was quite surprising and leads to interesting side effects.
We have an exciting family of crashes where:
and onLoad methods are called
before it calls takeView on its own presenters
they go ahead and call presenter onLoad
So now we have child presenters trying to load, and possibly asking their ancestor presenters to do stuff while the ancestors' views are still null. Crashes ensue.
@dnkoutso and I are pretty certain that the fix is simple: make presenters debounce their onLoad calls. It's already the case that Presenter#onLoad will not be called until takeView has been received. We should go further and make certain that onLoad will be called exactly once for any View instance.
We haven't thought yet of anything that this will break, and can think of lots of things that it will fix.
The text was updated successfully, but these errors were encountered: