#44312: Check usability of all objects that can changeafter signals Open Date: 2022-04-10 02:16 Last Update: 2022-05-06 12:23 URL for this Ticket: https://osdn.net//projects/freeciv/ticket/44312 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=44312 --------------------------------------------------------------------- Last Changes/Comment on this Ticket: 2022-05-06 12:23 Updated by: ihnatus Comment: Reply To cazfi You know that your process of first developing patch for the most stable branch and then going towards development master is backwards compared to the usual way? Not that it's any of my business, if that's the way you want to work, and with some fixes it does make sense (esp. if you can reproduce the problem in specific branch only). Only that we now have 3.0 patch waiting already, but we have no version to have in testing in unstable branches. I did it this way because number of signals grows in further versions and I wanted to start with a simpler task. Testing all these places already needs a lot of loop jumping. Probably I'll first make the HRM patch for 3.0 to not bother bypassing still dangerous code parts and test them together, and then will gradually advance both to the newer versions. --------------------------------------------------------------------- Ticket Status: Reporter: ihnatus Owner: (None) Type: Bugs Status: Open Priority: 5 - Medium MileStone: 3.0.2 Component: Server Severity: 5 - Medium Resolution: None --------------------------------------------------------------------- Ticket details: That problem is related to the realization of #44216 but actually parts of it (except player complete removal that is now impossible by scripts) already present in 3.0 branch. We must check after any direct or indirect call of any signal that any pointer on a unit, a city (or a player) we have obtained before the callback is valid when we use it after, and if so, that this object is still in the scope it is supposed to be (player is alive, city belongs to the same owner etc.) Maybe we have to rewrite some iterators in some places. Note: generic existence test for a city or a unit is comparing pointer at their saved index to their saved pointer. For players, this test is not 100% reliable since player indices may be reused but at least it guarantees that we get some valid player pointer, and the probability of creating new player object at the same memory address is low on most OSs. -- Ticket information of Freeciv project Freeciv Project is hosted on OSDN Project URL: https://osdn.net/projects/freeciv/ OSDN: https://osdn.net URL for this Ticket: https://osdn.net/projects/freeciv/ticket/44312 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=44312