Resolve race conditions in Attachments.more().

Props koopersmith
fixes #22656


git-svn-id: http://core.svn.wordpress.org/trunk@22957 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Ryan Boren 2012-11-30 16:45:43 +00:00
parent 59456a9cea
commit af42700ebd
1 changed files with 11 additions and 8 deletions

View File

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