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 right after clicking railroad construction button #5983

Closed
DorpsGek opened this issue Apr 13, 2014 · 6 comments
Closed

Crash right after clicking railroad construction button #5983

DorpsGek opened this issue Apr 13, 2014 · 6 comments
Labels
component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

Deweloper opened the ticket and wrote:

Steps to reproduce:

  1. Launch openttd
  2. Create a new game or load a saved game
  3. Click raiload construction button

Current result:
Program received signal SIGSEGV, Segmentation fault.
0x081728b1 in DropDownListParamStringItem::SetParam(unsigned int, unsigned long long) [clone .local.3958] (this=0x0, index=0, value=596382700407881728)
at /usr/src/debug/openttd-1.3.3/src/widgets/dropdown_type.h:67
67 virtual void SetParam(uint index, uint64 value) { decode_params[index] = value; }
(gdb) bt
# 0 0x081728b1 in DropDownListParamStringItem::SetParam(unsigned int, unsigned long long) [clone .local.3958] (this=0x0, index=0, value=596382700407881728)
at /usr/src/debug/openttd-1.3.3/src/widgets/dropdown_type.h:67
# 1 0x081d379b in GetRailTypeDropDownList (
for_replacement=for_replacement@entry=false)
at /usr/src/debug/openttd-1.3.3/src/rail_gui.cpp:1974
# 2 0x082ca062 in ToolbarBuildRailClick(Window*) [clone .674390] (w=0x8976720)
at /usr/src/debug/openttd-1.3.3/src/toolbar_gui.cpp:778
# 3 0x083e20d0 in DispatchLeftClickEvent (click_count=1, y=,
x=469, w=)
at /usr/src/debug/openttd-1.3.3/src/window.cpp:609
# 4 MouseLoop (mousewheel=, click=)
at /usr/src/debug/openttd-1.3.3/src/window.cpp:2687
# 5 HandleMouseEvents () at /usr/src/debug/openttd-1.3.3/src/window.cpp:2776
# 6 0x083f0235 in PollEvent (this=0x867be78)
at /usr/src/debug/openttd-1.3.3/src/video/sdl_v.cpp:584
# 7 VideoDriver_SDL::MainLoop() (this=0x867be78)
at /usr/src/debug/openttd-1.3.3/src/video/sdl_v.cpp:720
# 8 0x083f307d in ttd_main (argc=argc@entry=1, argv=argv@entry=0xbffff224)
at /usr/src/debug/openttd-1.3.3/src/openttd.cpp:848
# 9 0x0816cdc2 in main (argc=1, argv=0xbffff224)
at /usr/src/debug/openttd-1.3.3/src/os/unix/unix.cpp:275
(gdb) fr 1
# 1 0x081d379b in GetRailTypeDropDownList (
for_replacement=for_replacement@entry=false)
at /usr/src/debug/openttd-1.3.3/src/rail_gui.cpp:1974
1974 item->SetParam(1, rti->max_speed);
(gdb) print item
$1 = (DropDownListParamStringItem *) 0x8b61a00
(gdb) fr 0
# 0 0x081728b1 in DropDownListParamStringItem::SetParam(unsigned int, unsigned long long) [clone .local.3958] (this=0x0, index=0, value=596382700407881728)
at /usr/src/debug/openttd-1.3.3/src/widgets/dropdown_type.h:67
67 virtual void SetParam(uint index, uint64 value) { decode_params[index] = value; }
(gdb) print this
$2 = (DropDownListParamStringItem * const) 0x0

Version: openttd-1.3.3-1.fc20.i686

Attachments

Reported version: other
Operating system: Linux


This issue was imported from FlySpray: https://bugs.openttd.org/task/5983
@DorpsGek
Copy link
Member Author

Deweloper wrote:

Possibly a duplicate of # 5858, but unfortunately there is not much info there...


This comment was imported from FlySpray: https://bugs.openttd.org/task/5983#comment13234

@DorpsGek
Copy link
Member Author

Deweloper wrote:

The issue seems to be gone in openttd-1.4.0-1.fc20.i686.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5983#comment13244

@DorpsGek
Copy link
Member Author

DorpsGek commented May 1, 2014

frosch wrote:

I cannot extract anything from the backtrace that would make sense.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5983#comment13270

@DorpsGek
Copy link
Member Author

DorpsGek commented May 1, 2014

Deweloper wrote:

This crash is 100%-reproducible using openttd-1.3.3-1.fc20.i686 and the issue makes the game unplayable.
It seems that GetRailTypeDropDownList() calls SetParam on behalf of a NULL instance of DropDownListParamStringItem.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5983#comment13272

@DorpsGek
Copy link
Member Author

DorpsGek commented May 4, 2014

Rubidium wrote:

I think this bug is caused by a broken compiler.

Here's why:
a) of all the cases of this bug I have seen so far, it is always limited to fc20 and i686. Compiling it on 64 bits, or any other compiler does not seem to trigger this bug.
b) according to the different bug reports, 1.3.2 fails, 1.3.3-RC1 works, 1.3.3 fails. Between 1.3.3-RC1 and 1.3.3 there are no changes to the file, except that release candidates are built with assertions. In other words, the compiler generates different computer code for the same source code. Furthermore, 1.3.2 is different from 1.3.3 (but not in the broken function), so it is unlikely to be a fluke. However... why doesn't it show up more often? So possibly a distro specific patch.
c) 1.4.0 works, with slightly different code but no guards were added to check for NULL; actually only lines 1975 and 1977 of the function were changed, which is after the crash location.
d) the crash happens in line 1974, but exactly the same function is called with the same instance in line 1973. Why did it not crash there, if item is NULL?
e) C++'s new throws an exception when no memory could be allocated. As such, since there is no thrown exception, item must be a valid allocated pointer.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5983#comment13289

@DorpsGek
Copy link
Member Author

DorpsGek commented May 4, 2014

Rubidium closed the ticket.

Reason for closing: Won't fix

Bug in compiler, current code is different so compiler bug is not triggered.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5983

@DorpsGek DorpsGek closed this as completed May 4, 2014
@DorpsGek DorpsGek added component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) bug labels Apr 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

1 participant