mirror of
https://github.com/transmission/transmission
synced 2025-02-21 21:57:01 +00:00
(web) Improve upon r10773 fix for #3296
This commit is contained in:
parent
3a8809e38f
commit
dbcd1c942f
2 changed files with 11 additions and 5 deletions
|
@ -88,8 +88,9 @@ Torrent.prototype =
|
||||||
top_e.id = 'torrent_' + data.id;
|
top_e.id = 'torrent_' + data.id;
|
||||||
top_e._torrent = this;
|
top_e._torrent = this;
|
||||||
var element = $(top_e);
|
var element = $(top_e);
|
||||||
$(element).bind('dblclick', function(e) { transmission.toggleInspector(); });
|
$(element).bind('dblclick', function(e) { transmission.toggleInspector(); });
|
||||||
element._torrent = this;
|
element._torrent = this;
|
||||||
|
element._id = this._id;
|
||||||
this._element = element;
|
this._element = element;
|
||||||
this._controller = controller;
|
this._controller = controller;
|
||||||
controller._rows.push( element );
|
controller._rows.push( element );
|
||||||
|
|
|
@ -1606,10 +1606,15 @@ Transmission.prototype =
|
||||||
removedAny = true;
|
removedAny = true;
|
||||||
var e = torrent.element();
|
var e = torrent.element();
|
||||||
if( e ) {
|
if( e ) {
|
||||||
var row_index = tr.getTorrentIndex(tr._rows, torrent);
|
var row_index;
|
||||||
//if torrent is not currently visible then delete a hidden row
|
for( var i=0, row; row = tr._rows[i]; ++i ) {
|
||||||
//otherwise the row model gets corrupted because no row gets deleted
|
if( row._id == torrent._id )
|
||||||
if( row_index == null ) row_index = tr._rows.length - 1;
|
{
|
||||||
|
row_index = i;
|
||||||
|
e = tr._rows[row_index];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
delete e._torrent; //remove circular refernce to help IE garbage collect
|
delete e._torrent; //remove circular refernce to help IE garbage collect
|
||||||
tr._rows.splice(row_index, 1)
|
tr._rows.splice(row_index, 1)
|
||||||
e.remove();
|
e.remove();
|
||||||
|
|
Loading…
Reference in a new issue