socket.io connection event after disconnect event loses all browserWindow references #524

Open
opened 2026-01-29 16:41:57 +00:00 by claunia · 0 comments
Owner

Originally created by @MopsieX on GitHub (Jul 3, 2020).

Originally assigned to: @GregorBiswanger on GitHub.

  • Version: 9.31.1
  • Target: Windows 10

When the socket in main.js gets disconnected it deletes all the requires and then it will connect again. When the connection event fires again it reinitializes all of the requires however the windows[] and window variable aren't ever set in browserWindows.js. To fix it the main.js just needs to copy the references of all the windows before it deletes the require cache for browserWindows.js then after the browserWindows.js gets reinitialized/required the main.js needs to pass the windows to it.
Sorry for the bad explanation. I'm terrible at explaining things. If you have any questions or need clarification let me know.

Originally created by @MopsieX on GitHub (Jul 3, 2020). Originally assigned to: @GregorBiswanger on GitHub. <!-- Please search existing issues to avoid creating duplicates. --> <!-- Which version of Electron.NET CLI and API are you using? --> <!-- Please always try to use latest version before report. --> * **Version**: 9.31.1 <!-- Which version of .NET Core and Node.js are you using (if applicable)? --> <!-- What target are you building for? --> * **Target**: Windows 10 <!-- Enter your issue details below this comment. --> <!-- If you want, you can donate to increase issue priority (https://donorbox.org/electron-net) --> When the socket in main.js gets disconnected it deletes all the requires and then it will connect again. When the connection event fires again it reinitializes all of the requires however the windows[] and window variable aren't ever set in browserWindows.js. To fix it the main.js just needs to copy the references of all the windows before it deletes the require cache for browserWindows.js then after the browserWindows.js gets reinitialized/required the main.js needs to pass the windows to it. Sorry for the bad explanation. I'm terrible at explaining things. If you have any questions or need clarification let me know.
claunia added the bug label 2026-01-29 16:41:57 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#524