From 8abb150bd52aac99cf9ac17986e183d08342b685 Mon Sep 17 00:00:00 2001 From: Tad Taylor Date: Tue, 20 Feb 2024 20:03:46 -0700 Subject: [PATCH 01/14] Fix potential crash --- src/ClassicUO.Client/Game/UI/Gumps/ModernOptionsGump.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ClassicUO.Client/Game/UI/Gumps/ModernOptionsGump.cs b/src/ClassicUO.Client/Game/UI/Gumps/ModernOptionsGump.cs index 0db0ccfd3..374ae3295 100644 --- a/src/ClassicUO.Client/Game/UI/Gumps/ModernOptionsGump.cs +++ b/src/ClassicUO.Client/Game/UI/Gumps/ModernOptionsGump.cs @@ -5104,16 +5104,19 @@ protected override void OnMouseEnter(int x, int y) protected override void OnMouseWheel(MouseEventType delta) { + if (IsDisposed || _scrollBar == null) + { + return; + } + switch (delta) { case MouseEventType.WheelScrollUp: _scrollBar.Value -= _scrollBar.ScrollStep; - break; case MouseEventType.WheelScrollDown: _scrollBar.Value += _scrollBar.ScrollStep; - break; } } From 77173a72e5c5b819a099b8f892e2c5a1880f9471 Mon Sep 17 00:00:00 2001 From: Tad Taylor Date: Tue, 20 Feb 2024 20:08:13 -0700 Subject: [PATCH 02/14] Potential crash fix --- src/ClassicUO.Client/Game/UI/Gumps/HealthBarGump.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ClassicUO.Client/Game/UI/Gumps/HealthBarGump.cs b/src/ClassicUO.Client/Game/UI/Gumps/HealthBarGump.cs index e88250602..b602d2638 100644 --- a/src/ClassicUO.Client/Game/UI/Gumps/HealthBarGump.cs +++ b/src/ClassicUO.Client/Game/UI/Gumps/HealthBarGump.cs @@ -619,7 +619,7 @@ public override void Update() } } - if (_background.Hue != 912) + if (_background != null && _background.Hue != 912) { _background.Hue = 912; } @@ -1903,7 +1903,10 @@ public override void Update() } } - _bars[0].IsVisible = false; + if (_bars[0] != null) + { + _bars[0].IsVisible = false; + } } } From df381553c0514c7d68e718dfa62665932f53349a Mon Sep 17 00:00:00 2001 From: Tad Taylor Date: Tue, 20 Feb 2024 21:17:10 -0700 Subject: [PATCH 03/14] Update dev deploy, windows first and dotnet 8 --- .github/workflows/tuo-dev-deploy.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tuo-dev-deploy.yml b/.github/workflows/tuo-dev-deploy.yml index 3e7566765..6553f5d97 100644 --- a/.github/workflows/tuo-dev-deploy.yml +++ b/.github/workflows/tuo-dev-deploy.yml @@ -43,7 +43,7 @@ jobs: strategy: max-parallel: 1 matrix: - os: [ macos-latest, ubuntu-latest, windows-latest ] + os: [ windows-latest, macos-latest, ubuntu-latest ] steps: - uses: actions/checkout@v4 @@ -55,11 +55,11 @@ jobs: git config --global url."https://".insteadOf git:// git submodule update --init --recursive - - name: Setup .NET 7 - uses: actions/setup-dotnet@v3 + - name: Setup .NET 8 + uses: actions/setup-dotnet@v4 with: - dotnet-version: 7.0.x - include-prerelease: true + dotnet-version: 8.0.x + cache: true - name: Build run: dotnet publish ${{ env.CUO_PROJECT_PATH }} -c Release -o ${{ env.CUO_OUTPUT_PATH }} -p:IS_DEV_BUILD=true From d59b987682a39bcbf6a5ddaf889185ade6e8dda4 Mon Sep 17 00:00:00 2001 From: Tad Taylor Date: Tue, 20 Feb 2024 21:22:24 -0700 Subject: [PATCH 04/14] Update build-test.yml Update to dotnet 8 --- .github/workflows/build-test.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 1f5801bdf..839386633 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -26,21 +26,21 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ macos-latest, ubuntu-latest, windows-latest ] + os: [ windows-latest, macos-latest, ubuntu-latest ] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Get submodules run: | git config --global url."https://".insteadOf git:// git submodule update --init --recursive - - name: Setup .NET 7 - uses: actions/setup-dotnet@v3 + - name: Setup .NET 8 + uses: actions/setup-dotnet@v4 with: - dotnet-version: 7.0.x - include-prerelease: true + dotnet-version: 8.0.x + cache: true - name: Restore run: dotnet restore From f03729f42d312b4ea8610b0e2fbe8816174c70cc Mon Sep 17 00:00:00 2001 From: Tad Taylor Date: Tue, 20 Feb 2024 21:24:28 -0700 Subject: [PATCH 05/14] Update tuo-deploy.yml --- .github/workflows/tuo-deploy.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tuo-deploy.yml b/.github/workflows/tuo-deploy.yml index 3be090fe5..cc4974c5b 100644 --- a/.github/workflows/tuo-deploy.yml +++ b/.github/workflows/tuo-deploy.yml @@ -38,27 +38,27 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} build: - # if: ${{ github.event.workflow_run.conclusion == 'success' }} + if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ${{ matrix.os }} strategy: max-parallel: 1 matrix: - os: [ macos-latest, ubuntu-latest, windows-latest ] + os: [ windows-latest, macos-latest, ubuntu-latest ] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Get submodules run: | git config --global url."https://".insteadOf git:// git submodule update --init --recursive - - name: Setup .NET 7 - uses: actions/setup-dotnet@v3 + - name: Setup .NET 8 + uses: actions/setup-dotnet@v4 with: - dotnet-version: 7.0.x - include-prerelease: true + dotnet-version: 8.0.x + cache: true - name: Build run: dotnet publish ${{ env.CUO_PROJECT_PATH }} -c Release -o ${{ env.CUO_OUTPUT_PATH }} -p:IS_DEV_BUILD=true From b78ae769831a8276cefffa47c89782b0f63070cb Mon Sep 17 00:00:00 2001 From: Tad Taylor Date: Tue, 20 Feb 2024 21:26:55 -0700 Subject: [PATCH 06/14] Update build-test.yml --- .github/workflows/build-test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 839386633..fe62de37c 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -40,7 +40,6 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x - cache: true - name: Restore run: dotnet restore From d751710c7cbc5303fdccffebd1d29b6271d7555b Mon Sep 17 00:00:00 2001 From: Tad Taylor Date: Tue, 20 Feb 2024 21:28:31 -0700 Subject: [PATCH 07/14] Update tuo-deploy.yml --- .github/workflows/tuo-deploy.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/tuo-deploy.yml b/.github/workflows/tuo-deploy.yml index cc4974c5b..d9f4bf512 100644 --- a/.github/workflows/tuo-deploy.yml +++ b/.github/workflows/tuo-deploy.yml @@ -58,7 +58,6 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x - cache: true - name: Build run: dotnet publish ${{ env.CUO_PROJECT_PATH }} -c Release -o ${{ env.CUO_OUTPUT_PATH }} -p:IS_DEV_BUILD=true From 6906e66478bf9dab00b1bdb9e5e7b33bbd5ff91a Mon Sep 17 00:00:00 2001 From: Tad Taylor Date: Tue, 20 Feb 2024 21:28:45 -0700 Subject: [PATCH 08/14] Update tuo-dev-deploy.yml --- .github/workflows/tuo-dev-deploy.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/tuo-dev-deploy.yml b/.github/workflows/tuo-dev-deploy.yml index 6553f5d97..b052c1ec9 100644 --- a/.github/workflows/tuo-dev-deploy.yml +++ b/.github/workflows/tuo-dev-deploy.yml @@ -59,7 +59,6 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x - cache: true - name: Build run: dotnet publish ${{ env.CUO_PROJECT_PATH }} -c Release -o ${{ env.CUO_OUTPUT_PATH }} -p:IS_DEV_BUILD=true From 4512856a84b5b2013aff46dbf0a41964ef004e92 Mon Sep 17 00:00:00 2001 From: Tad Taylor Date: Tue, 20 Feb 2024 21:28:59 -0700 Subject: [PATCH 09/14] Delete .github/workflows/deploy.yml --- .github/workflows/deploy.yml | 92 ------------------------------------ 1 file changed, 92 deletions(-) delete mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 7aa2321b1..000000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,92 +0,0 @@ -name: Deploy - -on: - workflow_dispatch: - # workflow_run: - # branches: [main] - # workflows: [Build-Test] - # types: - # - completed - - -env: - CUO_ASSEMBLY_VERSION: '0.1.11.${{ github.run_number }}' - CUO_OUTPUT_PATH: '../../bin/dist' - CUO_PROJECT_PATH: "src/ClassicUO.Client/ClassicUO.Client.csproj" - CUO_ZIP_NAME: "ClassicUO-dev-preview-release.zip" - - DOTNET_NOLOGO: false - DOTNET_CLI_TELEMETRY_OPTOUT: 1 - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 - NUGET_XMLDOC_MODE: skip - -jobs: - build: - #if: ${{ github.event.workflow_run.conclusion == 'success' }} && "${{ env.GITHUB_REPOSITORY }}" == 'ClassicUO/ClassicUO' - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ ubuntu-latest ] - - steps: - - uses: actions/checkout@v2 - - - name: Get submodules - run: | - git config --global url."https://".insteadOf git:// - git submodule update --init --recursive - - - name: Setup .NET 7 - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 7.0.x - include-prerelease: true - - - name: Build - run: dotnet publish ${{ env.CUO_PROJECT_PATH }} -c Release -o ${{ env.CUO_OUTPUT_PATH }} -p:IS_DEV_BUILD=true -p:AssemblyVersion=${{ env.CUO_ASSEMBLY_VERSION }} -p:FileVersion=${{ env.CUO_ASSEMBLY_VERSION }} - - - name: Create manifest - run: | - dotnet run --project tools/ManifestCreator/ManifestCreator.csproj "${{ env.CUO_OUTPUT_PATH }}" "dev-preview" "${{ env.CUO_ZIP_NAME }}" - mkdir upload - mv manifest.xml upload - - - name: Create package - uses: thedoctor0/zip-release@master - with: - type: 'zip' - directory: ${{ env.CUO_OUTPUT_PATH }} - filename: ${{ env.CUO_ZIP_NAME }} - exclusions: '*.zip manifest.xml' - - - name: Move output - run: mv "${{ env.CUO_OUTPUT_PATH }}/${{ env.CUO_ZIP_NAME }}" upload - - - name: Remove old Release - uses: dev-drprasad/delete-tag-and-release@v0.2.1 - with: - delete_release: true - tag_name: ClassicUO-dev-release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Upload Release - uses: ncipollo/release-action@v1 - with: - artifacts: "upload/${{ env.CUO_ZIP_NAME }}" - name: 'ClassicUO dev preview' - body: 'This build may not be safe: use it at your own risk.' - prerelease: true - tag: ClassicUO-dev-release - token: ${{ secrets.GITHUB_TOKEN }} - - - name: FTP Deploy - uses: SamKirkland/FTP-Deploy-Action@4.3.2 - with: - server: ftp.classicuo.eu - username: ${{ secrets.FTP_USER }} - password: ${{ secrets.FTP_PSW }} - protocol: ftps - server-dir: /www.classicuo.eu/dev/deploy/ - local-dir: upload/ - From 24c6e7abda1b03cd12bb0e04153afc7abe3b333a Mon Sep 17 00:00:00 2001 From: Tad Taylor Date: Wed, 21 Feb 2024 04:35:11 -0700 Subject: [PATCH 10/14] More potential crash fixes --- src/ClassicUO.Client/ClassicUO.Client.csproj | 4 ++-- src/ClassicUO.Client/Game/UI/Gumps/HealthBarGump.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ClassicUO.Client/ClassicUO.Client.csproj b/src/ClassicUO.Client/ClassicUO.Client.csproj index f22236e4c..ef724ed28 100644 --- a/src/ClassicUO.Client/ClassicUO.Client.csproj +++ b/src/ClassicUO.Client/ClassicUO.Client.csproj @@ -5,8 +5,8 @@ cuoicon.ico ClassicUO ClassicUO - 3.21.1 - 3.21.1 + 3.21.2 + 3.21.2 diff --git a/src/ClassicUO.Client/Game/UI/Gumps/HealthBarGump.cs b/src/ClassicUO.Client/Game/UI/Gumps/HealthBarGump.cs index b602d2638..416aac2a7 100644 --- a/src/ClassicUO.Client/Game/UI/Gumps/HealthBarGump.cs +++ b/src/ClassicUO.Client/Game/UI/Gumps/HealthBarGump.cs @@ -624,7 +624,7 @@ public override void Update() _background.Hue = 912; } - if (_hpLineRed.LineColor != HPB_COLOR_GRAY) + if (_hpLineRed != null && _hpLineRed.LineColor != HPB_COLOR_GRAY) { _hpLineRed.LineColor = HPB_COLOR_GRAY; From 90f14835f0e90a49c4d40bf43d433dac3275627c Mon Sep 17 00:00:00 2001 From: Tad Taylor Date: Tue, 20 Feb 2024 21:52:59 -0700 Subject: [PATCH 11/14] Potential crash fix --- src/ClassicUO.Client/Game/UI/Gumps/HealthBarGump.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ClassicUO.Client/Game/UI/Gumps/HealthBarGump.cs b/src/ClassicUO.Client/Game/UI/Gumps/HealthBarGump.cs index 416aac2a7..2f04dfc1c 100644 --- a/src/ClassicUO.Client/Game/UI/Gumps/HealthBarGump.cs +++ b/src/ClassicUO.Client/Game/UI/Gumps/HealthBarGump.cs @@ -636,7 +636,10 @@ public override void Update() } } - _bars[0].IsVisible = false; + if (_bars[0] != null) + { + _bars[0].IsVisible = false; + } } } From 3cc08c785b1a8601e8df472b175ab935caa443b9 Mon Sep 17 00:00:00 2001 From: Tad Taylor Date: Tue, 20 Feb 2024 22:46:17 -0700 Subject: [PATCH 12/14] Add afterdispose method --- src/ClassicUO.Client/Game/UI/Controls/Control.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ClassicUO.Client/Game/UI/Controls/Control.cs b/src/ClassicUO.Client/Game/UI/Controls/Control.cs index f418e60e2..b591bb7ab 100644 --- a/src/ClassicUO.Client/Game/UI/Controls/Control.cs +++ b/src/ClassicUO.Client/Game/UI/Controls/Control.cs @@ -1063,6 +1063,12 @@ public virtual void Dispose() } IsDisposed = true; + AfterDispose(); } + + /// + /// Called after the control has been disposed. + /// + public virtual void AfterDispose() { } } } \ No newline at end of file From 3311b29018d15d5fec5304ad66ffb3dcecfbe731 Mon Sep 17 00:00:00 2001 From: Tad Taylor Date: Tue, 20 Feb 2024 22:46:41 -0700 Subject: [PATCH 13/14] Move textbox dispose to afterdispose --- .../Game/UI/Gumps/HealthBarGump.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/ClassicUO.Client/Game/UI/Gumps/HealthBarGump.cs b/src/ClassicUO.Client/Game/UI/Gumps/HealthBarGump.cs index 2f04dfc1c..553fb4fc1 100644 --- a/src/ClassicUO.Client/Game/UI/Gumps/HealthBarGump.cs +++ b/src/ClassicUO.Client/Game/UI/Gumps/HealthBarGump.cs @@ -140,17 +140,12 @@ protected set { } protected abstract void BuildGump(); - - public override void Dispose() + public override void AfterDispose() { - /*if (TargetManager.LastAttack != LocalSerial) - { - GameActions.SendCloseStatus(LocalSerial); - }*/ + base.AfterDispose(); _textBox?.Dispose(); _textBox = null; - base.Dispose(); } protected override void OnMove(int x, int y) @@ -410,6 +405,11 @@ protected override void OnMouseOver(int x, int y) public override bool Draw(UltimaBatcher2D batcher, int x, int y) { + if (IsDisposed) + { + return false; + } + base.Draw(batcher, x, y); if (Keyboard.Alt && UIManager.MouseOverControl != null && (UIManager.MouseOverControl == this || UIManager.MouseOverControl.RootParent == this)) @@ -1829,7 +1829,7 @@ public override void Update() { base.Update(); - if (IsDisposed /* || (_textBox != null && _textBox.IsDisposed)*/) + if (IsDisposed) { return; } @@ -2096,7 +2096,6 @@ public override void Update() } } - if (_bars.Length > 0 && _bars[0].Hue != hpForegroundHue) //HP Foreground { _bars[0].Hue = hpForegroundHue; From 0e88a9aab58269b80ed892de43f8700b9cdedf46 Mon Sep 17 00:00:00 2001 From: Tad Taylor Date: Tue, 20 Feb 2024 23:00:56 -0700 Subject: [PATCH 14/14] Fix healthbar gump causing crashes --- .../Game/UI/Gumps/HealthBarGump.cs | 23 ++++++++++++------- .../Game/UI/Gumps/VersionHistory.cs | 3 +++ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/ClassicUO.Client/Game/UI/Gumps/HealthBarGump.cs b/src/ClassicUO.Client/Game/UI/Gumps/HealthBarGump.cs index 553fb4fc1..f222daa0a 100644 --- a/src/ClassicUO.Client/Game/UI/Gumps/HealthBarGump.cs +++ b/src/ClassicUO.Client/Game/UI/Gumps/HealthBarGump.cs @@ -54,6 +54,7 @@ internal abstract class BaseHealthBarGump : AnchorableGump public bool IsLastAttackBar { get; set; } = false; public static BaseHealthBarGump LastAttackBar { get; set; } + protected bool HasBeenBuilt { get; set; } = false; protected BaseHealthBarGump(Entity entity) : this(0, 0) { @@ -71,6 +72,7 @@ protected BaseHealthBarGump(Entity entity) : this(0, 0) _isDead = entity is Mobile mm && mm.IsDead; BuildGump(); + HasBeenBuilt = true; } public virtual void SetNewMobile(uint serial) @@ -83,6 +85,7 @@ public virtual void SetNewMobile(uint serial) Children.Clear(); BuildGump(); + HasBeenBuilt = true; } } @@ -140,13 +143,13 @@ protected set { } protected abstract void BuildGump(); - public override void AfterDispose() - { - base.AfterDispose(); + //public override void AfterDispose() + //{ + // base.AfterDispose(); - _textBox?.Dispose(); - _textBox = null; - } + // _textBox?.Dispose(); + // _textBox = null; + //} protected override void OnMove(int x, int y) { @@ -176,6 +179,7 @@ public override void Restore(XmlElement xml) { _name = World.Player.Name; BuildGump(); + HasBeenBuilt = true; } else if (ProfileManager.CurrentProfile.SaveHealthbars) { @@ -196,6 +200,7 @@ public override void Restore(XmlElement xml) _outOfRange = true; BuildGump(); + HasBeenBuilt = true; } else { @@ -535,6 +540,7 @@ protected override void UpdateContents() if (_textBox != null) { _textBox.MouseUp -= TextBoxOnMouseUp; + _textBox.Dispose(); } _textBox = null; @@ -546,7 +552,7 @@ public override void Update() { base.Update(); - if (IsDisposed) + if (IsDisposed || !HasBeenBuilt) { return; } @@ -1580,6 +1586,7 @@ protected override void UpdateContents() if (_textBox != null) { _textBox.MouseUp -= TextBoxOnMouseUp; + _textBox.Dispose(); } _textBox = null; @@ -1829,7 +1836,7 @@ public override void Update() { base.Update(); - if (IsDisposed) + if (IsDisposed || !HasBeenBuilt) { return; } diff --git a/src/ClassicUO.Client/Game/UI/Gumps/VersionHistory.cs b/src/ClassicUO.Client/Game/UI/Gumps/VersionHistory.cs index da5442db1..623446d79 100644 --- a/src/ClassicUO.Client/Game/UI/Gumps/VersionHistory.cs +++ b/src/ClassicUO.Client/Game/UI/Gumps/VersionHistory.cs @@ -8,6 +8,9 @@ namespace ClassicUO.Game.UI.Gumps internal class VersionHistory : Gump { private static string[] updateTexts = { + "/c[white][3.21.2]/cd\n" + + "-A bugfix release for 3.21 causing crashes", + "/c[white][3.21.0]/cd\n" + "- A few bug fixes\n" + "- A few fixes from CUO\n" +