Skip to content

Commit f644f92

Browse files
committed
Merge branch 'development'
2 parents 5afc59c + 1a23aa3 commit f644f92

File tree

4 files changed

+28
-6
lines changed

4 files changed

+28
-6
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
NWN_VERSION=8193.34
2-
NWNX_VERSION=6a552d9
2+
NWNX_VERSION=3227d60

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file.
33

44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
55

6+
## 8193.34.7
7+
https://github.com/nwn-dotnet/Anvil/compare/v8193.34.6...v8193.34.7
8+
9+
### Package Updates
10+
- NWNX 6a552d9 -> 3227d60
11+
12+
### Fixed
13+
- Fixed an edge case issue that caused some servers to enter an infinite crash loop when shutting down.
14+
- Fixed `NWNX_CORE_SHUTDOWN_SCRIPT` throwing a NRE during shutdown.
15+
616
## 8193.34.6
717
https://github.com/nwn-dotnet/Anvil/compare/v8193.34.5...v8193.34.6
818

NWN.Anvil/src/main/API/Ruleset/NwRuleset.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using System.Collections.Generic;
23
using Anvil.Services;
34
using NWN.Native.API;
@@ -51,9 +52,9 @@ public static void ReloadRules()
5152

5253
[ServiceBinding(typeof(Factory))]
5354
[ServiceBindingOptions(InternalBindingPriority.API)]
54-
internal sealed unsafe class Factory
55+
internal sealed unsafe class Factory : IDisposable
5556
{
56-
private readonly FunctionHook<ReloadAllHook> reloadAllHook;
57+
private FunctionHook<ReloadAllHook> reloadAllHook;
5758

5859
public Factory(HookService hookService)
5960
{
@@ -142,8 +143,19 @@ private static IReadOnlyList<NwSpell> LoadSpells(CNWSpellArray spellArray)
142143

143144
private void OnReloadAll(void* pRules)
144145
{
145-
reloadAllHook.CallOriginal(pRules);
146-
LoadRules();
146+
if (reloadAllHook != null)
147+
{
148+
reloadAllHook.CallOriginal(pRules);
149+
LoadRules();
150+
}
151+
}
152+
153+
void IDisposable.Dispose()
154+
{
155+
// ReloadAll is called from the CNWSModule destructor
156+
// If we don't dispose the hook here, the server will get stuck in an infinite segfault loop.
157+
reloadAllHook?.Dispose();
158+
reloadAllHook = null;
147159
}
148160
}
149161
}

NWN.Anvil/src/main/Services/Core/VirtualMachineFunctionHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ internal int OnRunScript(string script, uint oidSelf)
9393
}
9494
catch (Exception e)
9595
{
96-
Log.Error(e);
96+
Log.Error(e, "An exception occured while executing script {Script}", script);
9797
}
9898

9999
scriptContexts.Pop();

0 commit comments

Comments
 (0)