mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-11 08:08:50 -04:00
Try to workaround certain versions of wine-mono crashing in GUI when clicking on Settings/Maps tab/Players tab, fixes #549
This commit is contained in:
parent
f2ece15935
commit
2d87519af2
85
GUI/Controls/HackyPropertyGrid.cs
Normal file
85
GUI/Controls/HackyPropertyGrid.cs
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015 MCGalaxy
|
||||||
|
|
||||||
|
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||||
|
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||||
|
not use this file except in compliance with the Licenses. You may
|
||||||
|
obtain a copy of the Licenses at
|
||||||
|
|
||||||
|
http://www.opensource.org/licenses/ecl2.php
|
||||||
|
http://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing,
|
||||||
|
software distributed under the Licenses are distributed on an "AS IS"
|
||||||
|
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||||
|
or implied. See the Licenses for the specific language governing
|
||||||
|
permissions and limitations under the Licenses.
|
||||||
|
*/
|
||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Windows.Forms.Design;
|
||||||
|
using System.Windows.Forms.PropertyGridInternal;
|
||||||
|
|
||||||
|
namespace MCGalaxy.Gui {
|
||||||
|
/// <summary> Hacky workaround class to fix crashing with some versions of wine-mono </summary>
|
||||||
|
public sealed class HackyPropertyGrid : PropertyGrid {
|
||||||
|
|
||||||
|
sealed class HackyPropertiesTab : PropertiesTab {
|
||||||
|
|
||||||
|
// With some versions of wine-mono, if you try to change PropertyGrid's selected object,
|
||||||
|
// some Exceptions gets thrown. (see examples below)
|
||||||
|
// The root cause of the Exception is a PropertiesTab instance returning 'null' from its
|
||||||
|
// Bitmap property implementation - so workaround this by never returning null.
|
||||||
|
public override Bitmap Bitmap {
|
||||||
|
get { return base.Bitmap ?? new Bitmap(16, 16); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected override PropertyTab CreatePropertyTab(Type tabType) { return new HackyPropertiesTab(); }
|
||||||
|
|
||||||
|
/*
|
||||||
|
Type: IndexOutOfRangeException
|
||||||
|
Source: System.Windows.Forms
|
||||||
|
Message: Index was outside the bounds of the array.
|
||||||
|
Target: UpdatePropertiesViewTabVisibility
|
||||||
|
Trace: at System.Windows.Forms.PropertyGrid.UpdatePropertiesViewTabVisibility ()
|
||||||
|
at System.Windows.Forms.PropertyGrid.ShowEventsButton (System.Boolean value)
|
||||||
|
at System.Windows.Forms.PropertyGrid.set_SelectedObjects (System.Object[] value)
|
||||||
|
at System.Windows.Forms.PropertyGrid.set_SelectedObject (System.Object value)
|
||||||
|
at (wrapper remoting-invoke-with-check) System.Windows.Forms.PropertyGrid.set_SelectedObject(object)
|
||||||
|
at MCGalaxy.Gui.Window.pl_listBox_Click (System.Object sender, System.EventArgs e)
|
||||||
|
at System.Windows.Forms.Control.OnClick (System.EventArgs e)
|
||||||
|
at System.Windows.Forms.ListBox.WndProc (System.Windows.Forms.Messagem)
|
||||||
|
at System.Windows.Forms.Control+ControlNativeWindow.OnMessage (System.Windows.Forms.Messagem)
|
||||||
|
at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Messagem)
|
||||||
|
at System.Windows.Forms.NativeWindow.Callback (System.IntPtr hWnd, System.Int32 msg, System.IntPtr wparam, System.IntPtr lparam)
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
Type: IndexOutOfRangeException
|
||||||
|
Source: System.Windows.Forms
|
||||||
|
Message: Index was outside the bounds of the array.
|
||||||
|
Target: RefreshProperties
|
||||||
|
Trace: at System.Windows.Forms.PropertyGrid.RefreshProperties (System.Boolean clearCached)
|
||||||
|
at System.Windows.Forms.PropertyGrid.Refresh (System.Boolean clearCached)
|
||||||
|
at System.Windows.Forms.PropertyGrid.Refresh ()
|
||||||
|
at System.Windows.Forms.PropertyGrid.OnFontChanged (System.EventArgs e)
|
||||||
|
at System.Windows.Forms.Control.AssignParent (System.Windows.Forms.Control value)
|
||||||
|
at System.Windows.Forms.Control+ControlCollection.Add (System.Windows.Forms.Control value)
|
||||||
|
at System.Windows.Forms.TabPage+TabPageControlCollection.Add (System.Windows.Forms.Control value)
|
||||||
|
at MCGalaxy.Gui.PropertyWindow.InitializeComponent ()
|
||||||
|
at MCGalaxy.Gui.PropertyWindow..ctor ()
|
||||||
|
at (wrapper remoting-invoke-with-check) MCGalaxy.Gui.PropertyWindow..ctor()
|
||||||
|
at MCGalaxy.Gui.Window.btnProperties_Click (System.Object sender, System.EventArgs e)
|
||||||
|
at System.Windows.Forms.Control.OnClick (System.EventArgs e)
|
||||||
|
at System.Windows.Forms.Button.OnClick (System.EventArgs e)
|
||||||
|
at System.Windows.Forms.Button.OnMouseUp (System.Windows.Forms.MouseEventArgs mevent)
|
||||||
|
at System.Windows.Forms.Control.WmMouseUp (System.Windows.Forms.Messagem, System.Windows.Forms.MouseButtons button, System.Int32 clicks)
|
||||||
|
at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Messagem)
|
||||||
|
at System.Windows.Forms.ButtonBase.WndProc (System.Windows.Forms.Messagem)
|
||||||
|
at System.Windows.Forms.Button.WndProc (System.Windows.Forms.Messagem)
|
||||||
|
at System.Windows.Forms.Control+ControlNativeWindow.OnMessage (System.Windows.Forms.Messagem)
|
||||||
|
at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Messagem)
|
||||||
|
at System.Windows.Forms.NativeWindow.Callback (System.IntPtr hWnd, System.Int32 msg, System.IntPtr wparam, System.IntPtr lparam)
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
@ -56,6 +56,7 @@
|
|||||||
<Compile Include="Controls\ColoredTextBox.cs">
|
<Compile Include="Controls\ColoredTextBox.cs">
|
||||||
<SubType>Component</SubType>
|
<SubType>Component</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Controls\HackyPropertyGrid.cs" />
|
||||||
<Compile Include="Controls\TimespanUpDown.cs" />
|
<Compile Include="Controls\TimespanUpDown.cs" />
|
||||||
<Compile Include="Descriptors.cs" />
|
<Compile Include="Descriptors.cs" />
|
||||||
<Compile Include="GuiPerms.cs" />
|
<Compile Include="GuiPerms.cs" />
|
||||||
|
2
GUI/PropertyWindow/PropertyWindow.Designer.cs
generated
2
GUI/PropertyWindow/PropertyWindow.Designer.cs
generated
@ -364,7 +364,7 @@ namespace MCGalaxy.Gui
|
|||||||
this.zs_lstNotUsed = new System.Windows.Forms.ListBox();
|
this.zs_lstNotUsed = new System.Windows.Forms.ListBox();
|
||||||
this.zs_lstUsed = new System.Windows.Forms.ListBox();
|
this.zs_lstUsed = new System.Windows.Forms.ListBox();
|
||||||
this.tabZS_old = new System.Windows.Forms.TabPage();
|
this.tabZS_old = new System.Windows.Forms.TabPage();
|
||||||
this.propsZG = new System.Windows.Forms.PropertyGrid();
|
this.propsZG = new MCGalaxy.Gui.HackyPropertyGrid();
|
||||||
this.tabCTF = new System.Windows.Forms.TabPage();
|
this.tabCTF = new System.Windows.Forms.TabPage();
|
||||||
this.ctf_grpControls = new System.Windows.Forms.GroupBox();
|
this.ctf_grpControls = new System.Windows.Forms.GroupBox();
|
||||||
this.ctf_btnEnd = new System.Windows.Forms.Button();
|
this.ctf_btnEnd = new System.Windows.Forms.Button();
|
||||||
|
4
GUI/Window/Window.Designer.cs
generated
4
GUI/Window/Window.Designer.cs
generated
@ -112,7 +112,7 @@ namespace MCGalaxy.Gui
|
|||||||
this.tabs = new System.Windows.Forms.TabControl();
|
this.tabs = new System.Windows.Forms.TabControl();
|
||||||
this.tp_Maps = new System.Windows.Forms.TabPage();
|
this.tp_Maps = new System.Windows.Forms.TabPage();
|
||||||
this.map_gbProps = new System.Windows.Forms.GroupBox();
|
this.map_gbProps = new System.Windows.Forms.GroupBox();
|
||||||
this.map_pgProps = new System.Windows.Forms.PropertyGrid();
|
this.map_pgProps = new MCGalaxy.Gui.HackyPropertyGrid();
|
||||||
this.map_gbLoaded = new System.Windows.Forms.GroupBox();
|
this.map_gbLoaded = new System.Windows.Forms.GroupBox();
|
||||||
this.map_lbLoaded = new System.Windows.Forms.ListBox();
|
this.map_lbLoaded = new System.Windows.Forms.ListBox();
|
||||||
this.map_gbUnloaded = new System.Windows.Forms.GroupBox();
|
this.map_gbUnloaded = new System.Windows.Forms.GroupBox();
|
||||||
@ -134,7 +134,7 @@ namespace MCGalaxy.Gui
|
|||||||
this.map_txtName = new System.Windows.Forms.TextBox();
|
this.map_txtName = new System.Windows.Forms.TextBox();
|
||||||
this.tp_Players = new System.Windows.Forms.TabPage();
|
this.tp_Players = new System.Windows.Forms.TabPage();
|
||||||
this.pl_gbProps = new System.Windows.Forms.GroupBox();
|
this.pl_gbProps = new System.Windows.Forms.GroupBox();
|
||||||
this.pl_pgProps = new System.Windows.Forms.PropertyGrid();
|
this.pl_pgProps = new MCGalaxy.Gui.HackyPropertyGrid();
|
||||||
this.pl_gbOther = new System.Windows.Forms.GroupBox();
|
this.pl_gbOther = new System.Windows.Forms.GroupBox();
|
||||||
this.pl_txtImpersonate = new System.Windows.Forms.TextBox();
|
this.pl_txtImpersonate = new System.Windows.Forms.TextBox();
|
||||||
this.pl_btnSendCommand = new System.Windows.Forms.Button();
|
this.pl_btnSendCommand = new System.Windows.Forms.Button();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user