LittleSaya / IndexOutOfRangeDSPMod

4 stars 2 forks source link

DSPTransportStat - IndexOutOfBounds when consecutively open remote stations #22

Closed mitasov-ra closed 1 year ago

mitasov-ra commented 2 years ago

image

Steps to reproduce:

  1. Open TransportStat
  2. Open any StationWindow
  3. Without closing the first one open another station
mitasov-ra commented 2 years ago

This exception doesn't occur every time I do these steps, but I caught it three or four times already. Also, seems like it can corrupt savegames

LittleSaya commented 2 years ago

Emm, I managed to reproduce this error, I will look into it

LittleSaya commented 2 years ago

Looks pretty similar to https://github.com/LittleSaya/DSPTransportStat/issues/3

and pretty random

LittleSaya commented 2 years ago

I think I know what happend here, when player closing the station window, it will access the entity pool of the station window's factory object with the ID of the object the player is currently inspecting on, in order to open stations on remote planet, I have to assign remote planet's factory object to station window's factory object, and when player clicking on a local station with remote station openning, it will first close the window, which will lead to access remote factory's entity pool with local object id, which may exceed the range, or may not exceed the range, pretty random, I think that's why I failed to reproduce the error in https://github.com/LittleSaya/DSPTransportStat/issues/3 . I will leave a comment here after I fix this bug.

LittleSaya commented 2 years ago

I uploaded a new version which should fix this bug