Skip to content

Commit cb92e20

Browse files
committed
Fixed crash when opening node context menu.
1 parent 551025c commit cb92e20

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

UI/MemoryViewControl.cs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ protected override void OnMouseClick(MouseEventArgs e)
217217
{
218218
Contract.Requires(e != null);
219219

220+
bool invalidate = false;
221+
220222
editBox.Visible = false;
221223

222224
foreach (var hotSpot in hotSpots)
@@ -230,10 +232,18 @@ protected override void OnMouseClick(MouseEventArgs e)
230232
if (hotSpot.Type == HotSpotType.OpenClose)
231233
{
232234
hitObject.ToggleLevelOpen(hotSpot.Level);
235+
236+
invalidate = true;
237+
238+
break;
233239
}
234240
else if (hotSpot.Type == HotSpotType.Click)
235241
{
236242
hitObject.Update(hotSpot);
243+
244+
invalidate = true;
245+
246+
break;
237247
}
238248
else if (hotSpot.Type == HotSpotType.Select)
239249
{
@@ -321,14 +331,22 @@ protected override void OnMouseClick(MouseEventArgs e)
321331

322332
selectedNodeContextMenuStrip.Show(this, e.Location);
323333
}
334+
335+
invalidate = true;
324336
}
325337
else if (hotSpot.Type == HotSpotType.Drop)
326338
{
327339
selectedNodeContextMenuStrip.Show(this, e.Location);
340+
341+
break;
328342
}
329343
else if (hotSpot.Type == HotSpotType.Delete)
330344
{
331345
RemoveSelectedNodes();
346+
347+
invalidate = true;
348+
349+
break;
332350
}
333351
else if (hotSpot.Type == HotSpotType.ChangeType)
334352
{
@@ -409,17 +427,22 @@ protected override void OnMouseClick(MouseEventArgs e)
409427
menu.Items.AddRange(items.ToArray());
410428
menu.Show(this, e.Location);
411429
}
430+
431+
break;
412432
}
413433
}
414434
catch (Exception ex)
415435
{
416436
Program.Logger.Log(ex);
417437
}
418-
419-
Invalidate();
420438
}
421439
}
422440

441+
if (invalidate)
442+
{
443+
Invalidate();
444+
}
445+
423446
base.OnMouseClick(e);
424447
}
425448

0 commit comments

Comments
 (0)