4 Answers
4

A race condition (applicable to both electronics and with programming) is when "the output and/or result of the process is unexpectedly and critically dependent on the sequence or timing of other events."

In general, methods that may safely directly or indirectly call themselves are re-entrant. If your event handlers are inadvertently raising other events that you cannot safely handle, you can say that you have non-reentrant code.

private void dataGridView1_CurrentCellChanged(object sender, EventArgs e)
{
//move to the next cell if we are in the first cell
if (dataGridView1.CurrentCell != null &&
dataGridView1.CurrentCell.RowIndex == 0 &&
dataGridView1.CurrentCell.ColumnIndex == 0)
{
//this does not throw an exception because
//the CurrentCell will be set some time later
dataGridView1.BeginInvoke(new MethodInvoker(() =>
{
dataGridView1.CurrentCell = dataGridView1[1, 0];
}));
}
}

The correction for the problem when it happens with events is sometimes referred to as de-bouncing, named after bits of electronic circuitry that do the same thing. So I suppose you could call the problem event bounce.

Nevertheless, the concept seems applicable to GUIs. After all, the term "bug" initially applied to hardware-related issues, but was transposed to software. You can criticize the author for not providing a definitive answer, but it's still an interesting remark, IMO.
–
JohNov 17 '11 at 12:04

2

The concept is very applicable to GUIs and anything else that generates events. In embedded systems, contact bounce is frequently corrected in software because it's easier and cheaper than adding a debounce circuit to each switch.
–
BlrflNov 17 '11 at 13:06