Hi,

Florian Köberle a écrit :
> Hello
>
> a network bug, discovered together with Jika looks like this:
>
> If you order the air plane to drop bombs at a very high place the the non
> turn master gets an assertion failure. (local_seed == random_seed)
>
> In the background the following happens:
> The plane drops the first bomb and stores a pointer to the last dropped
> bomb in a variable. The height of the last bomb is then used to determine
> when the next bomb should be dropped. However if the bomb is dropped at a
> place where the ground is very high then the bomb explodes before the
> second bomb gets dropped. When the bomb explodes it gets freed, but the
> plane does still access it. So if and when the second bomb gets dropped
> depends in this case if the computer reuses the space where the bomb
> object has been or not.
>   

by the way, this is not a real network game, we are only lucky (really 
?) that it does not crash violently.

Anyway, I'm against adding a new dependency such as Boost to fix this 
quite simple bug. Bug is normally fixed with tr...@6910. I'm not very 
fan of the fix, but I already dislike having one pointer to the last 
bomb, so...

> I suggest that we use the smart pointers of the boost library to fix this
> bug:
> I would use "shared_ptr"s in the object list and a weak_ptr in the plane.
> This way the plane will know when the bomb has exploded.
>
> Attached is a patch which sets the last bomb variable to NULL when the
> object gets freed. This way it becomes more obvious that it's buggy.
>   

Attached patch has been dropped by the mailing-list.

> Best regards,
> Florian

Regards,

Matt (gentildemon)

_______________________________________________
Wormux-dev mailing list
Wormux-dev@gna.org
https://mail.gna.org/listinfo/wormux-dev

Répondre à