fix(chat): release Utf8String when linkshell check rejects channel
Cherry-pick from ChatTwo upstream f35b7d3 (Infiziert90, 2026-05-12). Chat.SetChannel allocates a native Utf8String for the target name and then runs a validity check. The previous early return on an invalid linkshell skipped Dtor and leaked the native allocation; every invalid linkshell switch added one Utf8String to the unmanaged heap. - Renamed ValidAnyLinkshell to IsChannelOrExistingLinkshell so the call-site reads naturally. - Wrapped ChangeChatChannel in the validity check instead of early-returning. Dtor now runs on every path. - ChatLogWindow follows the rename at its single call-site.
This commit is contained in:
@@ -272,7 +272,10 @@ public sealed class ChatLogWindow : Window
|
||||
}
|
||||
}
|
||||
|
||||
if (targetChannel == null || !GameFunctions.Chat.ValidAnyLinkshell(targetChannel.Value))
|
||||
if (
|
||||
targetChannel == null
|
||||
|| !GameFunctions.Chat.IsChannelOrExistingLinkshell(targetChannel.Value)
|
||||
)
|
||||
{
|
||||
Plugin.Log.Warning(
|
||||
$"Channel was set to an invalid value '{targetChannel}', ignoring"
|
||||
|
||||
Reference in New Issue
Block a user