A few bug fixes to avoid crashes on Linux systems.

This commit is contained in:
Michael Möller
2010-05-22 15:51:59 +00:00
parent 1b36c9c181
commit 3550878a80
3 changed files with 22 additions and 6 deletions

View File

@@ -92,7 +92,7 @@ namespace OpenHardwareMonitor.GUI {
this.startMinMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.startMinMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.minTrayMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.minTrayMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.startupMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.startupMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator(); this.separatorMenuItem = new System.Windows.Forms.ToolStripSeparator();
this.temperatureUnitsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.temperatureUnitsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.celciusToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.celciusToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.fahrenheitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.fahrenheitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -362,7 +362,7 @@ namespace OpenHardwareMonitor.GUI {
this.startMinMenuItem, this.startMinMenuItem,
this.minTrayMenuItem, this.minTrayMenuItem,
this.startupMenuItem, this.startupMenuItem,
this.toolStripMenuItem3, this.separatorMenuItem,
this.temperatureUnitsToolStripMenuItem, this.temperatureUnitsToolStripMenuItem,
this.toolStripMenuItem4, this.toolStripMenuItem4,
this.hddMenuItem}); this.hddMenuItem});
@@ -395,8 +395,8 @@ namespace OpenHardwareMonitor.GUI {
// //
// toolStripMenuItem3 // toolStripMenuItem3
// //
this.toolStripMenuItem3.Name = "toolStripMenuItem3"; this.separatorMenuItem.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(204, 6); this.separatorMenuItem.Size = new System.Drawing.Size(204, 6);
// //
// temperatureUnitsToolStripMenuItem // temperatureUnitsToolStripMenuItem
// //
@@ -580,7 +580,7 @@ namespace OpenHardwareMonitor.GUI {
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2; private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem1; private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem minTrayMenuItem; private System.Windows.Forms.ToolStripMenuItem minTrayMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem3; private System.Windows.Forms.ToolStripSeparator separatorMenuItem;
private System.Windows.Forms.ContextMenuStrip sensorContextMenuStrip; private System.Windows.Forms.ContextMenuStrip sensorContextMenuStrip;
private System.Windows.Forms.ToolStripMenuItem startMinMenuItem; private System.Windows.Forms.ToolStripMenuItem startMinMenuItem;
private System.Windows.Forms.ToolStripMenuItem startupMenuItem; private System.Windows.Forms.ToolStripMenuItem startupMenuItem;

View File

@@ -155,6 +155,15 @@ namespace OpenHardwareMonitor.GUI {
UnitManager.TemperatureUnit == TemperatureUnit.Celcius; UnitManager.TemperatureUnit == TemperatureUnit.Celcius;
fahrenheitToolStripMenuItem.Checked = !celciusToolStripMenuItem.Checked; fahrenheitToolStripMenuItem.Checked = !celciusToolStripMenuItem.Checked;
// Hide the system tray and auto startup menu items on Unix
int p = (int)System.Environment.OSVersion.Platform;
if ((p == 4) || (p == 128)) {
startMinMenuItem.Visible = false;
minTrayMenuItem.Visible = false;
startupMenuItem.Visible = false;
separatorMenuItem.Visible = false;
}
if (startMinMenuItem.Checked) { if (startMinMenuItem.Checked) {
if (!minTrayMenuItem.Checked) { if (!minTrayMenuItem.Checked) {
WindowState = FormWindowState.Minimized; WindowState = FormWindowState.Minimized;

View File

@@ -101,6 +101,11 @@ namespace OpenHardwareMonitor.Hardware.CPU {
} }
public CPUGroup() { public CPUGroup() {
// No implementation for cpuid on Unix systems
int p = (int)System.Environment.OSVersion.Platform;
if ((p == 4) || (p == 128))
return;
if (!WinRing0.IsCpuid()) if (!WinRing0.IsCpuid())
return; return;
@@ -158,7 +163,9 @@ namespace OpenHardwareMonitor.Hardware.CPU {
} }
public string GetReport() { public string GetReport() {
if (threads == null)
return null;
StringBuilder r = new StringBuilder(); StringBuilder r = new StringBuilder();
r.AppendLine("CPUID"); r.AppendLine("CPUID");