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

memory leak ui.widget #513

Closed
wants to merge 9 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions ui/jquery.ui.widget.js
Expand Up @@ -322,8 +322,13 @@ $.Widget.prototype = {
$( this ).hasClass( "ui-state-disabled" ) ) {
return;
}
return ( typeof handler === "string" ? instance[ handler ] : handler )
.apply( instance, arguments );
// return ( typeof handler === "string" ? instance[ handler ] : handler )
// .apply( instance, arguments );
// bugfix memory leak http://bugs.jqueryui.com/ticket/7808
var ret = ( typeof handler === "string" ? instance[ handler ] : handler )
.apply( instance, arguments );
instance = null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this break the event handler for future events?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no problem because it makes it to null after the event in the future is executed.
function handlerProxy() {
:
instance = null;
retrun ret;
}

return ret;
}
var match = event.match( /^(\w+)\s*(.*)$/ ),
eventName = match[1] + "." + instance.widgetName,
Expand All @@ -333,6 +338,8 @@ $.Widget.prototype = {
} else {
element.bind( eventName, handlerProxy );
}
// bugfix memory leak http://bugs.jqueryui.com/ticket/7808
element = null;
});
},

Expand Down