Skip to content
This repository was archived by the owner on Aug 23, 2025. It is now read-only.

Commit 8d6c6f3

Browse files
committed
Merge branch 'fix-1.4.1' into vNext
2 parents 2c7857d + 6346174 commit 8d6c6f3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

86BoxManager/frmMain.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,8 @@ private void cmsVM_Opening(object sender, CancelEventArgs e)
415415
//Closing 86Box Manager before closing all the VMs can lead to weirdness if 86Box Manager is then restarted. So let's warn the user just in case and request confirmation.
416416
private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
417417
{
418-
List<ListViewItem> vms = new List<ListViewItem>();
418+
//List<ListViewItem> vms = new List<ListViewItem>();
419+
int vmCount = 0;
419420
if (e.CloseReason == CloseReason.UserClosing && closeTray)
420421
{
421422
e.Cancel = true;
@@ -430,21 +431,22 @@ private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
430431
VM vm = (VM)item.Tag;
431432
if (vm.Status != VM.STATUS_STOPPED && Visible)
432433
{
433-
vms.Add(item);
434+
vmCount++;
434435
}
435436
}
436437
}
437438

438439
//If there are running VMs, display the warning and stop the VMs if user says so
439-
if (vms.Count > 0)
440+
if (vmCount > 0)
440441
{
441442
e.Cancel = true;
442443
DialogResult = MessageBox.Show("It appears some virtual machines are still running. It's recommended you stop them first before closing 86Box Manager. Do you want to stop them now?", "Virtual machines are still running", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
443444
if (DialogResult == DialogResult.Yes)
444445
{
445-
foreach (ListViewItem lvi in vms)
446+
foreach (ListViewItem lvi in lstVMs.Items)
446447
{
447448
lvi.Focused = true;
449+
lvi.Selected = true;
448450
VMStop();
449451
}
450452
Thread.Sleep(1000); //Wait just a bit to make sure everything goes as planned

0 commit comments

Comments
 (0)