86Box / 86BoxManager

A configuration manager for the 86Box emulator
MIT License
352 stars 45 forks source link

Fix possible unintended order of execution on launch #92

Closed ts-korhonen closed 3 years ago

ts-korhonen commented 3 years ago

A video report of a bug from a user in 86Box discord suggests that frmMain_Load event can be fired before lstVMs is populated thus leading to exception: "InvalidArgument=Value of '0' is not valid for 'startIndex'.\r\nParameter name: startIndex" when started from a shortcut.

Moving LoadVMs (and LoadSettings for consistency) to frmMain_Load should make sure the list is ready. Also it is a common pattern to only initialize components in constructor and wait until loaded event is fired before using the components.