From e47753df2b913e97d1016510c47c01bb5a1e6e78 Mon Sep 17 00:00:00 2001 From: VitaNex Date: Sat, 11 Jun 2016 21:32:20 +0100 Subject: [PATCH] + Prevent NetState nullification recursion if the NetState is being disposed. * This issue is responsible for causing client crashes when logging out, one of the signs is the sound of your backpack closing multiple times. * Fix prevents multiple calls to subsystems such as the trade window, which had the potential to dupe items when returning them to the trade partner. * Credit goes to UO:Revealed (www.uorevealed.com) for reporting the circumstances which lead to the fix, which seems to have been an overlooked issue for a very long time. --- Server/Mobile.cs | 9 +++++++-- Server/Network/NetState.cs | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Server/Mobile.cs b/Server/Mobile.cs index e6caf1dba..d3d1c4b1d 100644 --- a/Server/Mobile.cs +++ b/Server/Mobile.cs @@ -8038,8 +8038,13 @@ namespace Server { get { - if( m_NetState != null && m_NetState.Socket == null ) - NetState = null; + if (m_NetState != null && m_NetState.Socket == null) + { + if (m_NetState.IsDisposing) + m_NetState = null; + else + NetState = null; + } return m_NetState; } diff --git a/Server/Network/NetState.cs b/Server/Network/NetState.cs index 5880b2171..d4de983ea 100644 --- a/Server/Network/NetState.cs +++ b/Server/Network/NetState.cs @@ -1114,6 +1114,8 @@ namespace Server.Network { private bool m_Disposing; + public bool IsDisposing { get { return m_Disposing; } } + public void Dispose() { Dispose( true ); }