Skip to content

Gravship travel between maps causes game freeze due to cross-map window reference #41

@notfood

Description

@notfood

ArgumentOutOfRangeException in Building_Window.MapUpdateHandler when accessing Map from wrong instance during Gravship landing.

Modlist:

    <li>brrainz.harmony</li>
    <li>ludeon.rimworld</li>
    <li>ludeon.rimworld.odyssey</li>
    <li>jpt.openthewindows</li>

Steps to reproduce:

  • Have a base with a window and a Gravship with a window on a different map.
  • Travel from a different base to your base with your Gravship.
  • Game freezes

Error can be found in:

if (info.map != Map) return;

Thing.Map isn't there yet, needs to check for Thing.Spawned before using it possibly.

Exception from long event: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
[Ref 3817840A]
 [0x0000c] in <e3b07672ffbd43c1838e1ebbe94cbdf5>:0 
  at System.Collections.Generic.List`1[T].get_Item (System.Int32 index) [0x00009] in <e3b07672ffbd43c1838e1ebbe94cbdf5>:0 
  at Verse.Thing.get_Map () [0x00013] in <1a4764477a744bde81c4adb46c2ccd65>:0 
  at OpenTheWindows.Building_Window.MapUpdateHandler (System.Object sender, OpenTheWindows.MapUpdateWatcher+MapUpdateInfo info) [0x00001] in <90c5609dff684b08a400b02af2d86df4>:0 
(wrapper delegate-invoke) System.EventHandler`1[OpenTheWindows.MapUpdateWatcher+MapUpdateInfo].invoke_void_object_TEventArgs(object,OpenTheWindows.MapUpdateWatcher/MapUpdateInfo)
  at OpenTheWindows.MapUpdateWatcher.OnMapUpdate (System.Object sender, OpenTheWindows.MapUpdateWatcher+MapUpdateInfo info) [0x0000a] in <90c5609dff684b08a400b02af2d86df4>:0 
  at OpenTheWindows.ThingGrid_Register.Postfix (Verse.Thing t, Verse.IntVec3 c) [0x00059] in <90c5609dff684b08a400b02af2d86df4>:0 
  at Verse.ThingGrid.RegisterInCell (Verse.Thing t, Verse.IntVec3 c) [0x0007d] in <1a4764477a744bde81c4adb46c2ccd65>:0 
    - POSTFIX JPT.OpenTheWindows: Void OpenTheWindows.ThingGrid_Register:Postfix(Thing t, IntVec3 c)
  at Verse.ThingGrid.Register (Verse.Thing t) [0x0002e] in <1a4764477a744bde81c4adb46c2ccd65>:0 
  at Verse.Thing.SpawnSetup (Verse.Map map, System.Boolean respawningAfterLoad) [0x001bb] in <1a4764477a744bde81c4adb46c2ccd65>:0 
  at Verse.ThingWithComps.SpawnSetup (Verse.Map map, System.Boolean respawningAfterLoad) [0x00000] in <1a4764477a744bde81c4adb46c2ccd65>:0 
  at Verse.Building.SpawnSetup (Verse.Map map, System.Boolean respawningAfterLoad) [0x0005d] in <1a4764477a744bde81c4adb46c2ccd65>:0 
    - POSTFIX JPT.OpenTheWindows: Void OpenTheWindows.Building_SpawnSetup:Postfix(Building __instance, Map map)
  at Verse.GenSpawn.Spawn (Verse.Thing newThing, Verse.IntVec3 loc, Verse.Map map, Verse.Rot4 rot, Verse.WipeMode wipeMode, System.Boolean respawningAfterLoad, System.Boolean forbidLeavings) [0x00276] in <1a4764477a744bde81c4adb46c2ccd65>:0 
  at RimWorld.GravshipPlacementUtility.SpawnNonPawnThings (RimWorld.Planet.Gravship gravship, Verse.Map map, System.Collections.Generic.List`1[T] gravshipThings, Verse.IntVec3 root) [0x00053] in <1a4764477a744bde81c4adb46c2ccd65>:0 
  at RimWorld.GravshipPlacementUtility.PlaceGravshipInMap (RimWorld.Planet.Gravship gravship, Verse.IntVec3 root, Verse.Map map, System.Collections.Generic.List`1[Verse.Thing]& spawned) [0x00094] in <1a4764477a744bde81c4adb46c2ccd65>:0 
  at Verse.WorldComponent_GravshipController.PlaceGravship (RimWorld.Planet.Gravship gravship, Verse.IntVec3 root, Verse.Map map) [0x00000] in <1a4764477a744bde81c4adb46c2ccd65>:0 
  at Verse.WorldComponent_GravshipController+<>c__DisplayClass53_2.<InitiateLanding>b__5 () [0x0006e] in <1a4764477a744bde81c4adb46c2ccd65>:0 
  at Verse.LongEventHandler.UpdateCurrentSynchronousEvent (System.Boolean& sceneChanged) [0x0001d] in <1a4764477a744bde81c4adb46c2ccd65>:0 

Attaching a save that reproduces the error, merely travel back to home.

GravshipFreeze.rws.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions