-
Notifications
You must be signed in to change notification settings - Fork 101
Presenter not destroyed when Fragment is popped off the backstack #33
Comments
I don't really understand why If |
Good catch, will investigate it |
I can verify this problem exists. But the fix isn't as easy always calling
for the following usecases:
Overall 72 cases, which should be tested. It was easier for the Activity where only 8 states are possible for 3 usecases (24 test). One reason I don't use Fragments anymore 😈 |
Interestingly, there is a bugfix in SupportLibrary
Maybe this caused some of the troubles |
@passsy |
^ s/@passy/@passsy/ :) |
Because I run into the same issue I want to share some stuff. We have a simple MasterDetail-Activity. In tablets landscape we display the MasterFragment on the left side and when we click on an item we put the DetailFragment on the right side. On our DetailPresenter I've put the following logic to fix the destroying: @Override
public void onDestroy() {
// Destroy presenter on phones (because they got detached). Otherwise they don't will destroy on backstackpress.
// On tablets we put on orientation change the fragment from one container to another.
// So we don't have to destroy the presenter but when the activity got finished
// see https://git.io/vMzfA
if (Utils.isPhone(getContext())) {
MLog.d(TAG, "Destroy on Phones");
getPresenter().destroy();
}
if (!mChangingConfigurations && Utils.isTablet(getContext())) {
getPresenter().destroy();
MLog.d(TAG, "Destroy on Tablets only when no configuration changed!");
}
super.onDestroy();
}
@Override
public void onStop() {
super.onStop();
mChangingConfigurations = ((TiActivity) getActivity()).isActivityChangingConfigurations();
} Everything is tested with AppCompat |
Do we have an estimate for when a fix might be available? If it's not within the next 2-3 weeks, I'll have to find an alternative solution. :( |
It's the last missing piece for the 0.8.0 release and will be targeted next. I can't give any time frame. |
Just to bump this issue: |
#78 is finally merged into master. We will publish a new release soon. |
v0.8.0-rc4 published |
When the back key is pressed to pop a
TiFragment
off the backstack, the Presenter does not get destroyed. Here is the log output fromTiFragment
:Because the activity is not being destroyed, the
destroyPresenter
flag inTiFragment#onDestroy()
does not get set to true. This means that the Presenter is leaked.The text was updated successfully, but these errors were encountered: