Results 1 to 3 of 3

Thread: Correct way to dispose of / delete a load mask?

  1. #1
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    88
    Answers
    3
    Vote Rating
    5
      0  

    Default Answered: Correct way to dispose of / delete a load mask?

    So I have been playing with loading masks for my application and currently I am using .hide(), but it seems like the loading mask object will just remain attached to the associated component and accumulate over time.

    I am unsure of how I should be disposing of loading masks, or even if I need to dispose of them in the first place.

  2. There is the potential for a leak here if you aren't careful. Hiding a loadmask won't destroy it, so if you keep creating and hiding loadmasks they'll leak. This type of leak is quite common with menus too, where hiding is often automatic but destruction isn't.

    Personally I try to use the setLoading method where possible:

    http://docs.sencha.com/ext-js/4-1/#!...hod-setLoading

    If you can't use that for some reason then you'll probably need to manage loadmask destruction yourself. Depending on your circumstances this may be as simple as calling destroy instead of hide.

    When I'm trying to test leaks I generally poll the value of:

    Code:
    Ext.ComponentManager.getCount();
    If you have a component leak it'll be reflected in that count.

  3. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,790
    Answers
    583
    Vote Rating
    391
      1  

    Default

    There is the potential for a leak here if you aren't careful. Hiding a loadmask won't destroy it, so if you keep creating and hiding loadmasks they'll leak. This type of leak is quite common with menus too, where hiding is often automatic but destruction isn't.

    Personally I try to use the setLoading method where possible:

    http://docs.sencha.com/ext-js/4-1/#!...hod-setLoading

    If you can't use that for some reason then you'll probably need to manage loadmask destruction yourself. Depending on your circumstances this may be as simple as calling destroy instead of hide.

    When I'm trying to test leaks I generally poll the value of:

    Code:
    Ext.ComponentManager.getCount();
    If you have a component leak it'll be reflected in that count.

  4. #3
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    88
    Answers
    3
    Vote Rating
    5
      0  

    Default

    Thanks, that is really helpful.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •