Skip to content
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

onDialogDismiss leaks context #25

Open
danvinokour opened this issue Feb 25, 2016 · 5 comments
Open

onDialogDismiss leaks context #25

danvinokour opened this issue Feb 25, 2016 · 5 comments

Comments

@danvinokour
Copy link

I saw that there is a memory leak in onDialogDismiss().
dialog.dismiss wasn't called and therefore a leak accoured.

Maybe you should add the listener before you start animator?

this is how i create the EasyDialog:
EasyDialog easyDialog = new EasyDialog(mContext.get()). setLocationByAttachedView(viewToAttach). setLayout(easyDialogView). setGravity(toolTip.getDirection()). setMatchParent(false). setAnimationAlphaShow(600, 0.0f, 1.0f). setAnimationAlphaDismiss(600, 1.0f, 0.0f);

I guess it because i am using animation.

@michaelye
Copy link
Owner

@danvinokour Ok,I will check it,thanks~

@danvinokour
Copy link
Author

Hi,
Do you have an estimation when you are planning to fix it?
It is pretty important for us..

@michaelye
Copy link
Owner

@danvinokour So sorry about that,danvinokour,I am very busy recently.I plan to fix it this weekend,ok?

@michaelye
Copy link
Owner

@danvinokour I test the code,it seems that everything works fine,could you please give me more debug info?
Here is my test code:

View view = this.getLayoutInflater().inflate(R.layout.layout_tip_content_horizontal, null);
Button btnOk = (Button)view.findViewById(R.id.btnOk);
final EasyDialog easyDialog = new EasyDialog(MainActivity.this)
                        .setLocationByAttachedView(btnTopLeft)
                        .setLayout(view)
                        .setGravity(EasyDialog.GRAVITY_BOTTOM)
                        .setMatchParent(false)
                        .setTouchOutsideDismiss(false)
                        .setAnimationAlphaShow(600, 0.0f, 1.0f)
                        .setAnimationAlphaDismiss(600, 1.0f, 0.0f);
                        easyDialog.show();
                btnOk.setOnClickListener(new View.OnClickListener()
                {
                    @Override
                    public void onClick(View v)
                    {
                        easyDialog.dismiss();
                    }
                });

@danvinokour
Copy link
Author

Hi,
There is a memory leak.. You can use leak canary to find it.
What happens is if i define animation in EasyDialog and i dismiss the
EasyDialog, you never call dialog.dismiss()..put some break points on
dialog.dismiss() and see that it is bot called.. Therefore the dialog stays
in memory and it has context which means that the activity is also leaked.

On Thu, Mar 3, 2016, 14:52 MichaelYe [email protected] wrote:

@danvinokour https://github.com/danvinokour I test the code,it seems
that everything works fine,could you please give me more debug info?
Here is my test code:

View view = this.getLayoutInflater().inflate(R.layout.layout_tip_content_horizontal, null);Button btnOk = (Button)view.findViewById(R.id.btnOk);final EasyDialog easyDialog = new EasyDialog(MainActivity.this)
.setLocationByAttachedView(btnTopLeft)
.setLayout(view)
.setGravity(EasyDialog.GRAVITY_BOTTOM)
.setMatchParent(false)
.setTouchOutsideDismiss(false)
.setAnimationAlphaShow(600, 0.0f, 1.0f)
.setAnimationAlphaDismiss(600, 1.0f, 0.0f);
easyDialog.show();
btnOk.setOnClickListener(new View.OnClickListener()
{
@OverRide
public void onClick(View v)
{
easyDialog.dismiss();
}
});


Reply to this email directly or view it on GitHub
#25 (comment)
.

Repository owner deleted a comment Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants