From 51e72b06c9714d9c4c1e912f35b6ba7d3d44be04 Mon Sep 17 00:00:00 2001 From: mattias Date: Tue, 19 Jan 2021 21:52:31 +0000 Subject: [PATCH] pastojs: fixed freeing temp intf var if nil --- compiler/utils/pas2js/dist/rtl.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/compiler/utils/pas2js/dist/rtl.js b/compiler/utils/pas2js/dist/rtl.js index 5c51ad4..6b66b8a 100644 --- a/compiler/utils/pas2js/dist/rtl.js +++ b/compiler/utils/pas2js/dist/rtl.js @@ -738,15 +738,20 @@ var rtl = { delete this[id]; old._Release(); // may fail } - this[id]=intf; + if(intf) { + this[id]=intf; + } return intf; }, free: function(){ //console.log('rtl.intfRefs.free...'); for (var id in this){ if (this.hasOwnProperty(id)){ - //console.log('rtl.intfRefs.free: id='+id+' '+this[id].$name+' $o='+this[id].$o.$classname); - this[id]._Release(); + var intf = this[id]; + if (intf){ + //console.log('rtl.intfRefs.free: id='+id+' '+intf.$name+' $o='+intf.$o.$classname); + intf._Release(); + } } } }