Open stephengtuggy opened 5 years ago
After further experimentation and examination of the code, it looks like we might need the Killed
concept after all. However, to prevent other threads from trying to read that property on an object that has already been destroyed, I suggest using some form of thread-safe smart pointers. (See #8 ).
std::atomic_flag or similar might be worth using for this property, also, in combination with smart pointers for the Unit
object (and descendants) as a whole.
While a "segfault" report is serious, this report is lacking enough information not to be
The minimum need for a proper BUG report is
Based on lack of needed informatiom I recommend this issue be closed
My apologies. I thought I had filled in the environment information for this bug months ago.
Okay, here goes; The OS was Ubuntu 18.04 LTS, I believe. 64-bit CPU: 8th-generation Intel Core i5-8500, 6-core, 3.00 GHz Main system RAM: 16 GB of DDR4 Graphics: GeForce GTX 1050 Ti, with 4 GB of dedicated GDDR5 Motherboard: Gigabyte H370M-DS3H Main system storage: 500GB M.2 NVMe SSD
I think there were two error messages displayed, one after the other. I no longer remember the first one, only the second one, which was the segfault message, in the terminal that I was running vegastrike from.
I do not have a specific series of actions to reproduce the problem, but I am guaranteed to see it on my hardware within about 20 minutes of gameplay or less, one way or another.
@LifWirser do you see anything else I'm missing?
This might still be an issue; I'm not sure. If it is, the problem may only show up when DESTRUCTDEBUG
is defined.
Just now, I got a segfault in the
inline bool
methodUnit::Killed()
. Judging by the comment just above, indicating that thevoid Kill()
method deletes an object, it seems to me that trying to read the value ofKilled
is a bad idea in general. It would never returntrue
, onlyfalse
or... segfault. Why? Because in the latter case, the object has been deleted, and it no longer exists in memory!We should probably do away with the whole concept of
Killed
, and use smart pointers instead, to avoid trying to access memory that has been reclaimed.