Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash/assertion failure when removing airport when hangar window open and OrderBackup present #9113

Closed
JGRennison opened this issue Apr 26, 2021 · 1 comment

Comments

@JGRennison
Copy link
Contributor

issue-9113.zip

Version of OpenTTD

43b6f69 (Linux, SDL)

Steps to reproduce

  1. Build an airport
  2. Open the hangar window
  3. Build an aircraft
  4. Give the aircraft at least one order
  5. Sell the aircraft (so that an OrderBackup is created)
  6. Demolish the airport, without closing the hangar window first

Note that this is not quite the same as #8809, as this bug is triggered by removing an OrderBackup, not looking at an airport tile.
The original report is here: JGRennison/OpenTTD-patches#252

Less ugly stack trace
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff7278859 in __GI_abort () at abort.c:79
#2  0x00007ffff7278729 in __assert_fail_base (fmt=0x7ffff740e588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5555563f73b4 "_docommand_recursive == 0", file=0x5555563f7250 "/home/jgr/misc/openttd-2/src/command.cpp", 
    line=637, function=<optimised out>) at assert.c:92
#3  0x00007ffff7289f36 in __GI___assert_fail (assertion=0x5555563f73b4 "_docommand_recursive == 0", file=0x5555563f7250 "/home/jgr/misc/openttd-2/src/command.cpp", line=637, 
    function=0x5555563f7318 "CommandCost DoCommandPInternal(TileIndex, uint32, uint32, uint32, void (*)(const CommandCost&, TileIndex, uint32, uint32, uint32), const char*, bool, bool)") at assert.c:101
#4  0x0000555555d3b6b7 in DoCommandPInternal (tile=238, p1=0, p2=1, cmd=38, callback=0x0, text=0x0, my_cmd=true, estimate_only=false) at /home/jgr/misc/openttd-2/src/command.cpp:637
#5  0x0000555555f18406 in OrderBackup::Reset (t=238, from_gui=true) at /home/jgr/misc/openttd-2/src/order_backup.cpp:201
#6  0x0000555555d73ea8 in DepotWindow::~DepotWindow (this=0x5555586c3430, __in_chrg=<optimised out>) at /home/jgr/misc/openttd-2/src/depot_gui.cpp:298
#7  0x0000555555d73f10 in DepotWindow::~DepotWindow (this=0x5555586c3430, __in_chrg=<optimised out>) at /home/jgr/misc/openttd-2/src/depot_gui.cpp:299
#8  0x00005555560dfd67 in DeleteWindowById (cls=WC_VEHICLE_DEPOT, number=238, force=true) at /home/jgr/misc/openttd-2/src/window.cpp:1169
#9  0x0000555555fd6442 in RemoveAirport (tile=233, flags=DC_EXEC) at /home/jgr/misc/openttd-2/src/station_cmd.cpp:2397
#10 0x0000555555fdda00 in ClearTile_Station (tile=362, flags=DC_EXEC) at /home/jgr/misc/openttd-2/src/station_cmd.cpp:4316
#11 0x0000555555e4e3e4 in CmdLandscapeClear (tile=362, flags=DC_EXEC, p1=0, p2=0, text=0x0) at /home/jgr/misc/openttd-2/src/landscape.cpp:723
#12 0x0000555555d3b0b7 in DoCommand (tile=362, p1=0, p2=0, flags=DC_EXEC, cmd=4, text=0x0) at /home/jgr/misc/openttd-2/src/command.cpp:506
#13 0x0000555555e4e824 in CmdClearArea (tile=362, flags=DC_EXEC, p1=362, p2=0, text=0x0) at /home/jgr/misc/openttd-2/src/landscape.cpp:775
#14 0x0000555555d3bce0 in DoCommandPInternal (tile=362, p1=362, p2=0, cmd=236847180, callback=0x555555e52fd4 <CcPlaySound_EXPLOSION(CommandCost const&, unsigned int, unsigned int, unsigned int, unsigned int)>, text=0x0, my_cmd=true, 
    estimate_only=false) at /home/jgr/misc/openttd-2/src/command.cpp:725
#15 0x0000555555d3b42e in DoCommandP (tile=362, p1=362, p2=0, cmd=236847180, callback=0x555555e52fd4 <CcPlaySound_EXPLOSION(CommandCost const&, unsigned int, unsigned int, unsigned int, unsigned int)>, text=0x0, my_cmd=true)
    at /home/jgr/misc/openttd-2/src/command.cpp:589
#16 0x0000555556026050 in GUIPlaceProcDragXY (proc=DDSP_DEMOLISH_AREA, start_tile=362, end_tile=362) at /home/jgr/misc/openttd-2/src/terraform_gui.cpp:117
#17 0x0000555555d0bf66 in BuildAirToolbarWindow::OnPlaceMouseUp (this=0x55555862a3a0, select_method=VPM_X_AND_Y, select_proc=DDSP_DEMOLISH_AREA, pt=..., start_tile=362, end_tile=362) at /home/jgr/misc/openttd-2/src/airport_gui.cpp:151
#18 0x00005555560be0d0 in VpHandlePlaceSizingDrag () at /home/jgr/misc/openttd-2/src/viewport.cpp:3346
#19 0x00005555560e438d in MouseLoop (click=MC_NONE, mousewheel=0) at /home/jgr/misc/openttd-2/src/window.cpp:2893
#20 0x00005555560e4b48 in HandleMouseEvents () at /home/jgr/misc/openttd-2/src/window.cpp:3058
#21 0x0000555555cf1e12 in VideoDriver_SDL_Base::PollEvent (this=0x555558472a30) at /home/jgr/misc/openttd-2/src/video/sdl2_v.cpp:448
#22 0x0000555555cf74f7 in VideoDriver::Tick (this=0x555558472a30) at /home/jgr/misc/openttd-2/src/video/video_driver.cpp:167
#23 0x0000555555cf245f in VideoDriver_SDL_Base::LoopOnce (this=0x555558472a30) at /home/jgr/misc/openttd-2/src/video/sdl2_v.cpp:642
#24 0x0000555555cf24a3 in VideoDriver_SDL_Base::MainLoop (this=0x555558472a30) at /home/jgr/misc/openttd-2/src/video/sdl2_v.cpp:660
#25 0x0000555555f0ed11 in openttd_main (argc=2, argv=0x7fffffffdba8) at /home/jgr/misc/openttd-2/src/openttd.cpp:833
#26 0x0000555555c3c20d in main (argc=2, argv=0x7fffffffdba8) at /home/jgr/misc/openttd-2/src/os/unix/unix.cpp:262
@LordAro LordAro changed the title Crash/assertion failure when removing airport when hangar window open and OrderBackup present Crash/assertion failure when removing airport when hangar window open and OrderBackup present Apr 26, 2021
@LordAro
Copy link
Member

LordAro commented Apr 26, 2021

Not sure if I'm reading it right, but I wonder if this is a consequence of #8815 and

if (IsHangarTile(tile_cur)) OrderBackup::Reset(tile_cur, false);

should be moved before the window deletion a few lines further up

OpenTTD/src/station_cmd.cpp

Lines 2396 to 2400 in 43b6f69

for (uint i = 0; i < st->airport.GetNumHangars(); ++i) {
DeleteWindowById(
WC_VEHICLE_DEPOT, st->airport.GetHangarTile(i)
);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants