Resolve race conditions in Attachments.more().

Props koopersmith
fixes #22656


git-svn-id: https://develop.svn.wordpress.org/trunk@22957 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2012-11-30 16:45:43 +00:00
parent 303f2bd2ff
commit 0996e3d153
1 changed files with 11 additions and 8 deletions

View File

@ -3071,11 +3071,17 @@
}
},
removeContent: function() {
_.each(['attachments','uploader'], function( key ) {
if ( this[ key ] ) {
this[ key ].remove();
delete this[ key ];
}
}, this );
},
createUploader: function() {
if ( this.attachments ) {
this.attachments.remove();
delete this.attachments;
}
this.removeContent();
this.uploader = new media.view.UploaderInline({
controller: this.controller
@ -3085,10 +3091,7 @@
},
createAttachments: function() {
if ( this.uploader ) {
this.uploader.remove();
delete this.uploader;
}
this.removeContent();
this.attachments = new media.view.Attachments({
controller: this.controller,