From c38e9242a2d8c83c464c603aa24a8dce6285d9a2 Mon Sep 17 00:00:00 2001
From: Aru <17498701+Arufonsu@users.noreply.github.com>
Date: Tue, 6 Jan 2026 20:58:46 -0300
Subject: [PATCH 1/3] fix: crash when opening the settings window after
changing tile dimensions
Fixes #2795
This fix ensures that when updating value ranges within Sliders and LabeledSliders:
- If the new minimum is greater than the current maximum, we set the maximum first to avoid the validation error
- If the new maximum is less than the current minimum, we set the minimum first
- Otherwise, we can safely set them in the original order
This prevents the intermediate state where minimum temporarily exceeds maximum, which was causing the crash when opening the settings window after changing tile dimensions.
---
.../Gwen/Control/LabeledSlider.cs | 20 ++++++++++++++++++-
.../Gwen/Control/Slider.cs | 18 +++++++++++++++--
2 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/Intersect.Client.Framework/Gwen/Control/LabeledSlider.cs b/Intersect.Client.Framework/Gwen/Control/LabeledSlider.cs
index 20d4b670ea..56af960e26 100644
--- a/Intersect.Client.Framework/Gwen/Control/LabeledSlider.cs
+++ b/Intersect.Client.Framework/Gwen/Control/LabeledSlider.cs
@@ -378,7 +378,25 @@ protected override void OnChildSizeChanged(Base child, Point oldChildSize, Point
SizeToChildren(resizeX: AutoSizeToContentWidthOnChildResize, resizeY: AutoSizeToContentHeightOnChildResize);
}
- public void SetRange(double min, double max) => (Minimum, Maximum) = (min, max);
+ public void SetRange(double min, double max)
+ {
+ if (min > Maximum)
+ {
+ Maximum = max;
+ Minimum = min;
+ }
+ else if (max < Minimum)
+ {
+ Minimum = min;
+ Maximum = max;
+ }
+ else
+ {
+ // Safe to set in either order
+ Minimum = min;
+ Maximum = max;
+ }
+ }
public bool AutoSizeToContents
{
diff --git a/Intersect.Client.Framework/Gwen/Control/Slider.cs b/Intersect.Client.Framework/Gwen/Control/Slider.cs
index f47fb7d4d4..4a7bbb8bc8 100644
--- a/Intersect.Client.Framework/Gwen/Control/Slider.cs
+++ b/Intersect.Client.Framework/Gwen/Control/Slider.cs
@@ -458,8 +458,22 @@ protected virtual void SetValueInternal(double newInternalValue, bool forceUpdat
/// Maximum value.
public void SetRange(double min, double max)
{
- _minimumValue = min;
- _maximumValue = max;
+ if (min > Maximum)
+ {
+ _maximumValue = max;
+ _minimumValue = min;
+ }
+ else if (max < Minimum)
+ {
+ _minimumValue = min;
+ _maximumValue = max;
+ }
+ else
+ {
+ // Safe to set in either order
+ _minimumValue = min;
+ _maximumValue = max;
+ }
}
///
From 387594d420c4c5bf8d42fcbe53eec9a5d25bcab8 Mon Sep 17 00:00:00 2001
From: Arufonsu <17498701+Arufonsu@users.noreply.github.com>
Date: Sat, 31 Jan 2026 21:00:49 -0300
Subject: [PATCH 2/3] panda's review (I)
(tested: working as intended!)
Signed-off-by: Arufonsu <17498701+Arufonsu@users.noreply.github.com>
---
.../Gwen/Control/LabeledSlider.cs | 19 ++++++++-----------
.../Gwen/Control/Slider.cs | 19 ++++++++-----------
2 files changed, 16 insertions(+), 22 deletions(-)
diff --git a/Intersect.Client.Framework/Gwen/Control/LabeledSlider.cs b/Intersect.Client.Framework/Gwen/Control/LabeledSlider.cs
index 56af960e26..6c8b21570f 100644
--- a/Intersect.Client.Framework/Gwen/Control/LabeledSlider.cs
+++ b/Intersect.Client.Framework/Gwen/Control/LabeledSlider.cs
@@ -380,21 +380,18 @@ protected override void OnChildSizeChanged(Base child, Point oldChildSize, Point
public void SetRange(double min, double max)
{
- if (min > Maximum)
- {
- Maximum = max;
- Minimum = min;
- }
- else if (max < Minimum)
+ var actualMin = Math.Min(min, max);
+ var actualMax = Math.Max(min, max);
+
+ if (actualMin > Maximum)
{
- Minimum = min;
- Maximum = max;
+ Maximum = actualMax;
+ Minimum = actualMin;
}
else
{
- // Safe to set in either order
- Minimum = min;
- Maximum = max;
+ Minimum = actualMin;
+ Maximum = actualMax;
}
}
diff --git a/Intersect.Client.Framework/Gwen/Control/Slider.cs b/Intersect.Client.Framework/Gwen/Control/Slider.cs
index 4a7bbb8bc8..9d62e3945a 100644
--- a/Intersect.Client.Framework/Gwen/Control/Slider.cs
+++ b/Intersect.Client.Framework/Gwen/Control/Slider.cs
@@ -458,21 +458,18 @@ protected virtual void SetValueInternal(double newInternalValue, bool forceUpdat
/// Maximum value.
public void SetRange(double min, double max)
{
- if (min > Maximum)
- {
- _maximumValue = max;
- _minimumValue = min;
- }
- else if (max < Minimum)
+ var actualMin = Math.Min(min, max);
+ var actualMax = Math.Max(min, max);
+
+ if (actualMin > Maximum)
{
- _minimumValue = min;
- _maximumValue = max;
+ _maximumValue = actualMax;
+ _minimumValue = actualMin;
}
else
{
- // Safe to set in either order
- _minimumValue = min;
- _maximumValue = max;
+ _minimumValue = actualMin;
+ _maximumValue = actualMax;
}
}
From d7dc419e3113661835bc0c6f38ab0ed402123e41 Mon Sep 17 00:00:00 2001
From: Arufonsu <17498701+Arufonsu@users.noreply.github.com>
Date: Sat, 28 Feb 2026 22:12:27 -0300
Subject: [PATCH 3/3] panda's review (II)
Signed-off-by: Arufonsu <17498701+Arufonsu@users.noreply.github.com>
---
Intersect.Client.Framework/Gwen/Control/LabeledSlider.cs | 5 +++++
Intersect.Client.Framework/Gwen/Control/Slider.cs | 7 ++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/Intersect.Client.Framework/Gwen/Control/LabeledSlider.cs b/Intersect.Client.Framework/Gwen/Control/LabeledSlider.cs
index 6c8b21570f..dd36481d7b 100644
--- a/Intersect.Client.Framework/Gwen/Control/LabeledSlider.cs
+++ b/Intersect.Client.Framework/Gwen/Control/LabeledSlider.cs
@@ -388,6 +388,11 @@ public void SetRange(double min, double max)
Maximum = actualMax;
Minimum = actualMin;
}
+ else if (actualMax < Minimum)
+ {
+ Minimum = actualMin;
+ Maximum = actualMax;
+ }
else
{
Minimum = actualMin;
diff --git a/Intersect.Client.Framework/Gwen/Control/Slider.cs b/Intersect.Client.Framework/Gwen/Control/Slider.cs
index 9d62e3945a..77a8c5835d 100644
--- a/Intersect.Client.Framework/Gwen/Control/Slider.cs
+++ b/Intersect.Client.Framework/Gwen/Control/Slider.cs
@@ -461,11 +461,16 @@ public void SetRange(double min, double max)
var actualMin = Math.Min(min, max);
var actualMax = Math.Max(min, max);
- if (actualMin > Maximum)
+ if (actualMin > _maximumValue)
{
_maximumValue = actualMax;
_minimumValue = actualMin;
}
+ else if (actualMax < _minimumValue)
+ {
+ _minimumValue = actualMin;
+ _maximumValue = actualMax;
+ }
else
{
_minimumValue = actualMin;