Skip to content
This repository was archived by the owner on Jun 8, 2019. It is now read-only.
This repository was archived by the owner on Jun 8, 2019. It is now read-only.

reorder remove() and _leaveChildren() in leave method under composite_view.js #32

@Kufert

Description

@Kufert

I'm having some memory leaks caused by components added to the screen via various jQuery plugins. After few hours of debugging, I found that those plugins have a destroy API I can all from the view before detaching it to prevent the memory leak. I tried to call this from leave() on the view, but that did not work.

It seems like the issue is now with the order of the calls remove() and _leaveChildren() in the code:

  leave: function() {
    this.trigger('leave');
    this.unbind();
    this.stopListening();
    this.remove();
    this._leaveChildren();
    this._removeFromParent();
  },

because remove() removes the view, and only then the view leave() method is called by running _leaveChildren(), the item is not really destroyed as it is no longer on the scree, resulting in memory leak.

My Q - can I change the order? what is the reason behind the current order?
If you think it's OK, I'll create PR with that change.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions