From 357498a06335e6079dfb2cc0e0cf28f8712a80ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=B6ller?= Date: Sat, 4 Jun 2011 13:27:11 +0000 Subject: [PATCH] Fixed a problem preventing the plot form getting closed correctly. This did prevent the application from terminating when asked to exit by the operating system (for example at shutdown). --- GUI/MainForm.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/GUI/MainForm.cs b/GUI/MainForm.cs index 94cabc3..9a62f82 100644 --- a/GUI/MainForm.cs +++ b/GUI/MainForm.cs @@ -315,12 +315,17 @@ namespace OpenHardwareMonitor.GUI { break; } }; - plotForm.Closing += delegate(object sender, CancelEventArgs e) { - if (plotLocation.Value == 0) { - showPlot.Value = false; + + plotForm.FormClosing += delegate(object sender, FormClosingEventArgs e) { + if (e.CloseReason == CloseReason.UserClosing) { + // just switch off the plotting when the user closes the form + if (plotLocation.Value == 0) { + showPlot.Value = false; + } + e.Cancel = true; } - e.Cancel = true; }; + EventHandler moveOrResizePlotForm = delegate(object sender, EventArgs e) { if (plotForm.WindowState != FormWindowState.Minimized) { settings.SetValue("plotForm.Location.X", plotForm.Bounds.X);