shpaass / yafc-ce

Powerful Factorio calculator/analyser that works with mods
GNU General Public License v3.0
66 stars 20 forks source link

YaFC freeze because all windows are inactive #192

Closed Dorus closed 3 months ago

Dorus commented 3 months ago

I just had an error pop up, and after that, YaFC could was no longer responsive. The line if (inputSystem == null) { return; } in yafc-ce\Yafc.UI\Core\Ui.cs:70 always returns false. All windows in ActiveInputSystem had .active == false.

A possible solution would be to change line 28 to

public static InputSystem? ActiveInputSystem => windows.Values.FirstOrDefault(w => w.active)?.InputSystem ?? windows.Values.FirstOrDefault()?.InputSystem; to ensure there's always an inputsystem. But i'm not entirely sure on the expected working of the input system. @DaleStan .

DaleStan commented 3 months ago

I'm afraid I don't know how the InputSystem is supposed to work either. If you switch to or merge 47c67617, that particular version of #178 should go away, but I still have crashes/hangs with that code. On the other hand, if there's significantly fewer crashes, we should merge it anyway. (The potential advantage of 47c67617 is that it reverts 5676ce7, which I never liked.)

I have no sense of whether it's an improvement because I can never tell whether my computer's in "five crashes in fifteen minutes" mode or "one crash in fifteen hours" mode.

Dorus commented 3 months ago

Do you have any Pr for those changes, or are you still working on them? Indeed reverting https://github.com/shpaass/yafc-ce/commit/5676ce7ac9e6285c09c0b95de30dbe60856acacd seems to remove the offending LoC i was looking at here.