SVGHMI: prevent man-made memory leak by limiting back button history items count to 42 svghmi
authorEdouard Tisserant
Mon, 30 Mar 2020 11:06:12 +0200
branchsvghmi
changeset 2905 3d7e3866cc51
parent 2904 92d115d8828d
child 2906 3b4a1319da09
SVGHMI: prevent man-made memory leak by limiting back button history items count to 42
svghmi/gen_index_xhtml.xslt
svghmi/svghmi.js
--- a/svghmi/gen_index_xhtml.xslt	Sun Mar 29 16:11:21 2020 +0200
+++ b/svghmi/gen_index_xhtml.xslt	Mon Mar 30 11:06:12 2020 +0200
@@ -1903,6 +1903,10 @@
 </xsl:text>
     <xsl:text>    jump_history.push([page_name, page_index]);
 </xsl:text>
+    <xsl:text>    if(jump_history.length &gt; 4)
+</xsl:text>
+    <xsl:text>        jump_history.shift();
+</xsl:text>
     <xsl:text>
 </xsl:text>
     <xsl:text>    return true;
--- a/svghmi/svghmi.js	Sun Mar 29 16:11:21 2020 +0200
+++ b/svghmi/svghmi.js	Mon Mar 30 11:06:12 2020 +0200
@@ -313,6 +313,8 @@
     requestHMIAnimation();
 
     jump_history.push([page_name, page_index]);
+    if(jump_history.length > 42)
+        jump_history.shift();
 
     return true;
 };