PDA

View Full Version : window.close function causes FG crash



Moon Wizard
April 24th, 2009, 02:27
Recently, I've added a close button in the upper right corner of all windows in my rulesets to allow windows to be quickly closed similar to standard Windows. The button code is simple:



function onClickDown(button, x, y)
if button == 1 then
return true;
end
end

function onClickRelease(button, x, y)
if button == 1 then
window.close();
end
end


While the feature appears to work great at first, many of my testers report that after closing anywhere from 3-10 windows using the close button, FG will crash. I have not been able to reproduce on my machine, but my machines tend to be fairly high spec.

Any ideas why window.close() would cause FG to hard crash?

Thanks,
JPG

Foen
April 24th, 2009, 06:15
This was a prevalent issue in an earlier FG2 release, which had been reportedly fixed (although I can't find the post). There may be something with having multiple windows which implies the fix isn't very stable.

Tenian
April 24th, 2009, 11:33
Oddly the radial close never seems to cause a crash.

It might be hacky but as a workaround is it possible just to simulate activating the radial close? Or are the default radial menus not available in code?

Foen
April 24th, 2009, 16:38
I suspect the crash problem comes from the fact that code is executing within the context of the form, so destroying the form unloads the code while it is still executing.

The radial close isn't exposed to code, but it may still suffer the same problem if it were called from the form context.

Just my guesses on this one.

Griogre
April 24th, 2009, 20:21
For what is worth, when I see code like that I also wonder about lag. I bet the server would never have a problem but I wonder about clients giving the commands remotely, especially where they are closing a bunch of windows on a bad connection. Kinda the inverse of Foen's theory.