Skip to content

Commit

Permalink
Fixed a minor bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
zboris12 committed Oct 15, 2022
1 parent fe2fd48 commit 5c9ac47
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions zgapdfsigner.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,26 +105,16 @@ z.NewRefMap = class extends Map{
a_new = new z.NewRef(a_oety[0], ++this.idx);
this.set(a_tag, a_new);
}
a_new.changeNumber();
}.bind(this));
if(encref){
this.get(encref.tag).changeNumber();
}
this.changeAll();
return encref;
}

/**
* @public
*/
restoreAll(){
/** @type {Iterator} */
var es = this.entries();
/** @type {IIterableResult} */
var result = es.next();
while(!result.done){
result.value[1].changeNumber(true);
result = es.next();
}
this.changeAll(true);
this.clear();
this.idx = 0;
this.pdfcont = null;
Expand Down Expand Up @@ -182,6 +172,22 @@ z.NewRefMap = class extends Map{
return;
}
}

/**
* @private
* @param {boolean=} restore
*/
changeAll(restore){
/** @type {Iterator} */
var es = this.entries();
/** @type {IIterableResult} */
var result = es.next();
while(!result.done){
result.value[1].changeNumber(restore);
result = es.next();
}
}

};

/** @type {z.NewRefMap<string, z.NewRef>} */
Expand Down

0 comments on commit 5c9ac47

Please sign in to comment.