#44312: Check usability of all objects that can change after signals Open Date: 2022-04-10 02:16 Last Update: 2022-06-11 15:51 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-06-11 15:51 Updated by: cazfi * Milestone Update from 3.0.2 to 3.0.3 --------------------------------------------------------------------- Ticket Status: Reporter: ihnatus Owner: (None) Type: Bugs Status: Open Priority: 5 - Medium MileStone: 3.0.3 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