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

Commit e650b45

Browse files
committed
Improved the handling of launch timeout
User-defined timeout is now used. The timeout warning has been improved, the offending process can now be killed to prevent entering a limbo state. PID is now obtained immediately after the process is started.
1 parent 4010163 commit e650b45

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

86BoxManager/frmMain.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -519,12 +519,13 @@ private void VMStart()
519519
}
520520

521521
p.Start();
522-
bool initSuccess = p.WaitForInputIdle(5000); //Wait 5 seconds so hWnd can be obtained
522+
vm.Pid = p.Id;
523+
bool initSuccess = p.WaitForInputIdle(launchTimeout); //Wait 5 seconds so hWnd can be obtained
523524

524525
if (!p.MainWindowHandle.Equals(IntPtr.Zero) && initSuccess)
525526
{
526527
vm.hWnd = p.MainWindowHandle; //Get the window handle of the newly created process
527-
vm.Pid = p.Id; //Assign the pid to the VM
528+
//vm.Pid = p.Id; //Assign the pid to the VM
528529
vm.Status = VM.STATUS_RUNNING;
529530
lstVMs.SelectedItems[0].SubItems[1].Text = vm.GetStatusString();
530531
lstVMs.SelectedItems[0].ImageIndex = 1;
@@ -557,8 +558,11 @@ private void VMStart()
557558
btnConfigure.Enabled = true;
558559
}
559560
else
560-
{
561-
MessageBox.Show("The 86Box process did not initialize in time. This could be due to poor system performance, or it could indicate a bug. Consider contacting the developer.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
561+
{ //Inform the user what happened
562+
MessageBox.Show("The 86Box process did not initialize in time. This usually happens due to poor system performance.\n\nIf you see this message often, consider increasing the timeout value in the settings. It's recommended that you kill the associated 86Box process now.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
563+
564+
//And try to stop the process so we don't end up in limbo land...
565+
VMKill();
562566
}
563567
}
564568
}

0 commit comments

Comments
 (0)