core.sessionmanager: Mark session as destroyed to prevent reentry 0.12
authorKim Alvefur <zash@zash.se>
Thu, 19 Jan 2023 21:40:09 +0100
branch0.12
changeset 12882 0d8bf401fa73
parent 12881 f6cca7cbf3b2
child 12883 09a53ed8f4d5
core.sessionmanager: Mark session as destroyed to prevent reentry If it reaches this point, then the session will be most definitely be destroyed, so try to prevent destroy_session() from being called again.
core/sessionmanager.lua
--- a/core/sessionmanager.lua	Thu Jan 19 21:38:14 2023 +0100
+++ b/core/sessionmanager.lua	Thu Jan 19 21:40:09 2023 +0100
@@ -106,6 +106,7 @@
 		if host_session.events.fire_event("pre-resource-unbind", {session=session, error=err}) then
 			return;
 		end
+		session.destroyed = true; -- Past this point the session is DOOMED!
 
 		host_session.sessions[session.username].sessions[session.resource] = nil;
 		full_sessions[session.full_jid] = nil;