-
Notifications
You must be signed in to change notification settings - Fork 841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible bug in FragmentMvpDelegateImpl onDestroyView() #231
Comments
Thanks for this super helpful bug report! Indeed you have to delegate I will work on that right now, fix should be available soon. |
@sockeqwe Thanks for a quick response. You're right, there are no crashes if presenter should be kept. |
Is fixed, thanks for reporting. Fix is available in A stable |
Thanks again for your very detailed bug report and sample repository to reproduce the bug (it was super helpful)! |
Hi there.
I think there is a possible bug in the latest Mosby release, when using custom
DialogFragment
, which has MVP structure and usesFragmentMvpDelegateImpl
. MVP dialog is shown inside activity with it's own MVP. I have created a sample repo to help reproduce this issue.Mosby Version: 3.0.0
Actual behavior: crash when closing fragment dialog with MVP
Sample repository: https://github.com/epetrenko/MosbyFragmentMvpDelegateExample
There are two main parts in my sample repo:
MvpActivity
);AppCompatDialogFragment
and implementsMvpDelegateCallback
). Login dialog is shown from main screen by clicking on a button. It's done only for example.Presenters and views are dummy in my example. Dagger stuff was added only as example.
LoginDialogFragment
hasFragmentMvpDelegateImpl
:I don't need to preserve presenter neither during screen orientation nor on backstack.
MainActivity
is implemented only in portrait orientation.Lifecycle methods are overriden in
LoginDialogFragment
:Application is crashed after
onDestroyView()
call ondelegate
. I'm not sure shouldonDestroyView()
be overriden or not, because StatisticsDialog have noonDestroyView()
overriding in mail sample from Mosby repo.I checked
onDestroyView()
method implementation inFragmentMvpDelegateImpl
:Method
retainPresenterInstance()
returnsfalse
(as I noticed above I don't need to keep presenter in all cases). ThereforePresenterManager.remove(activity, mosbyViewId)
method should be fired.Inside
PresenterManager.remove(activity, viewId)
method we have the following:As
activityScope
isn'tnull
, we go intoactivityScope.remove(viewId)
. And this method throwsNullPointerException
exception, becauseviewId
isnull
.If
onDestroyView()
overriding should not be used here, then all is working properly. Hope it helps.The text was updated successfully, but these errors were encountered: