From cc2ed144843ef5ebc4353b7096708355cab3b992 Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Tue, 29 Aug 2023 01:42:48 +0200 Subject: [PATCH] Reset c.sc after calling onclose. The onclose callback might want to access c.sc. --- static/protocol.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/static/protocol.js b/static/protocol.js index 99b6e4f..bcfdf93 100644 --- a/static/protocol.js +++ b/static/protocol.js @@ -1216,10 +1216,11 @@ Stream.prototype.close = function(replace) { let changed = recomputeUserStreams(c.sc, userid); if(changed && c.sc.onuser) c.sc.onuser.call(c.sc, userid, "change"); - c.sc = null; if(c.onclose) c.onclose.call(c, replace); + + c.sc = null; }; /**