R-T-B / TimberbornTerrainGenerator

A Terrain Generator for Beavers everywhere
MIT License
1 stars 2 forks source link

Cancel button crashes with stack error after a few presses #7

Closed R-T-B closed 2 years ago

R-T-B commented 2 years ago

We need to pursue a solution, even if it's just removing the button and using ESC key instead.

R-T-B commented 2 years ago

The issue was the buttons were declared as static, thus, they had the cancel (and also map generate actions!) assigned to them more than once every time you recreated the dialog. This could be alleviated by the initial fix code I did to discover this:

if (thisNewMapBox._panelStack._stack.Count == 3) { thisNewMapBox._panelStack.Pop(thisNewMapBox); }

but frankly, it was far cleaner to make the buttons non static. Eliminated the try-catches too. Some members need to be static for outside access to their values, the buttons do not, at all. Fixed in v1.1.1, out in seconds.