<p dir="auto">frameless window maximize / unmaximize event may cause a error on windows.</p>
<p dir="auto">it unable to reproduce stable, maybe a GC problem?</p>
<p dir="auto">screenshot:</p>
<p dir="auto"><a href="https://ygobbs.com/t/%E7%AA%97%E5%8F%A3%E5%81%9A%E5%A4%A7%E5%8C%96%E5%90%8E%E5%86%8D%E6%AC%A1%E7%82%B9%E5%87%BB%E6%97%A0%E6%B3%95%E7%BC%A9%E5%B0%8F%E5%9B%9E%E5%8E%9F%E6%9D%A5%E5%B0%BA%E5%AF%B8/78751" rel="nofollow">https://ygobbs.com/t/%E7%AA%97%E5%8F%A3%E5%81%9A%E5%A4%A7%E5%8C%96%E5%90%8E%E5%86%8D%E6%AC%A1%E7%82%B9%E5%87%BB%E6%97%A0%E6%B3%95%E7%BC%A9%E5%B0%8F%E5%9B%9E%E5%8E%9F%E6%9D%A5%E5%B0%BA%E5%AF%B8/78751</a></p>
<p dir="auto">my code:<br>
<a href="https://github.com/mycard/mycard/blob/master/js/app.js#L5-L25">https://github.com/mycard/mycard/blob/master/js/app.js#L5-L25</a></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="const current_window = remote.getCurrentWindow();

document.getElementById(&quot;minimize&quot;).onclick = ()=&gt; {
    current_window.minimize()
};
document.getElementById(&quot;maximize&quot;).onclick = ()=&gt; {
    current_window.maximize();
};
document.getElementById(&quot;restore&quot;).onclick = ()=&gt; {
    current_window.unmaximize();
};
document.getElementById(&quot;close&quot;).onclick = ()=&gt; {
    current_window.close();
};

current_window.on('maximize', ()=&gt; {
    document.body.className = process.platform + ' maximized'
});
current_window.on('unmaximize', ()=&gt; {
    document.body.className = process.platform
});"><pre class="notranslate"><code class="notranslate">const current_window = remote.getCurrentWindow();

document.getElementById("minimize").onclick = ()=&gt; {
    current_window.minimize()
};
document.getElementById("maximize").onclick = ()=&gt; {
    current_window.maximize();
};
document.getElementById("restore").onclick = ()=&gt; {
    current_window.unmaximize();
};
document.getElementById("close").onclick = ()=&gt; {
    current_window.close();
};

current_window.on('maximize', ()=&gt; {
    document.body.className = process.platform + ' maximized'
});
current_window.on('unmaximize', ()=&gt; {
    document.body.className = process.platform
});
</code></pre></div>
<p dir="auto">Hi,<br>
I am building a simple one page electron app with a simple HTML page with a menu using sample code shown here: [https://github.com/atom/electron/blob/master/docs/api/menu.md]</p>
<p dir="auto">But I am getting a javascript error on SECOND page reload on a simple electron app. Note that this error only comes if I reload the app once and then click View-&gt;Reload again.</p>
<p dir="auto">"Uncaught exception error: Attempting to call a functions in the renderer window that has been closed or released. Function provided here: undefined".</p>
<p dir="auto">I have even gone through this case but did not understand how to remove call back reference for my simple case. Here is the code I have in my simple HTML page:</p>
<p dir="auto"><a href="https://jsfiddle.net/fb2a3ho6/" rel="nofollow">https://jsfiddle.net/fb2a3ho6/</a></p>
<p dir="auto">I would like to know why on second refresh, when reference to the old window is lost, I am getting an error.</p>
<p dir="auto">Vivek</p>