MantisBT - Doomseeker
View Issue Details
0003477Doomseeker[All Projects] Bugpublic2018-08-30 09:582018-10-13 19:09
Zalewa 
 
lowtweakN/A
acknowledgedopen 
1.1 
 
0003477: ServerPtr and multiple "sources of truth"
There is a problem with multiple "sources of truth" when it comes to storing in memory all Server objects known to the program runtime. Some time ago we have solved crashes caused by using deleted Server objects by introducing ServerPtr, but it is still vague what is responsible for maintenance of their lifetime.

Depending on the server type, it is stored on following lists:

Master-server servers:
- ServerListModel ("GUI" element)
- MasterManager
- MasterClient

Custom/Pinned servers:
- ServerListModel ("GUI" element)
- CustomServers (which itself is stored in MasterManager)

LAN servers:
- ServerListModel ("GUI" element)
- BroadcastManager (which is owned by MainWindow GUI element)

This begun to cause problems upon implementation of 0003388 which allows the "Master-server servers" to be dynamically converted into "Custom servers" and then survive the total refresh. This exposed a problem with disconnect() where the Server was made "mute" to the world while still being on the list. Calling disconnect() is not unlike using the 'delete' instruction, the only difference is if there is an error in ownership assumption, in the latter case the program will crash, and in the former it will go into undefined states.

Ownership issues should be resolved - possibly by removing all collections of servers from MasterClients, MasterManagers, CustomServers and etc. In some cases it will be necessary to keep such "secondary" list, however none of the objects other than the sanctioned one should assume any ownership privileges.

It looks like ServerListModel should be the best candidate for the "single source of truth", however there's an issue of it being a GUI element. On the other hand, this GUI element already must have information on servers for filtering and sorting purposes and for performance, so perhaps it's the only logical place.
No tags attached.
related to 0003388closed Zalewa Mark servers as favorite 
related to 0003397closed Pol M Buddies in LAN servers are not detected. 
Issue History
2018-08-30 09:58ZalewaNew Issue
2018-08-30 09:59ZalewaRelationship addedrelated to 0003388
2018-10-05 06:36WubTheCaptainPrioritynormal => low
2018-10-13 14:45ZalewaRelationship addedrelated to 0003397
2018-10-13 19:09WubTheCaptainStatusnew => acknowledged

There are no notes attached to this issue.