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]: When selecting some NewGRF rail stations, road stops, etc due to changed semantics of SetFocusedWidget #11655

Closed
JGRennison opened this issue Dec 30, 2023 · 0 comments

Comments

@JGRennison
Copy link
Contributor

Version of OpenTTD

Since #11641

Steps to reproduce

Try to select NewGRF rail stations, road stops, etc

Upload crash files

#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737275480832) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=140737275480832) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=140737275480832, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x00007ffff6f9b476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007ffff6f817f3 in __GI_abort () at ./stdlib/abort.c:79
#5  0x00007ffff6f8171b in __assert_fail_base
    (fmt=0x7ffff7136130 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5555561bdb5d "widget != nullptr", file=0x5555561bd8c0 "/home/jgr/openttd/trunk/src/window.cpp", line=490, function=<optimised out>) at ./assert/assert.c:92
#6  0x00007ffff6f92e96 in __GI___assert_fail (assertion=0x5555561bdb5d "widget != nullptr", file=0x5555561bd8c0 "/home/jgr/openttd/trunk/src/window.cpp", line=490, function=0x5555561bd940 "bool Window::SetFocusedWidget(WidgetID)")
    at ./assert/assert.c:101
#7  0x00005555560e308f in Window::SetFocusedWidget(int) (this=this@entry=0x555558429c50, widget_index=widget_index@entry=262165) at /home/jgr/openttd/trunk/src/window.cpp:490
#8  0x00005555560e9bb9 in DispatchLeftClickEvent (click_count=1, y=177, x=228, w=0x555558429c50) at /home/jgr/openttd/trunk/src/window.cpp:645
#9  MouseLoop (mousewheel=<optimised out>, click=<optimised out>) at /home/jgr/openttd/trunk/src/window.cpp:2841
#10 HandleMouseEvents() () at /home/jgr/openttd/trunk/src/window.cpp:2938
#11 0x0000555555c93055 in VideoDriver_SDL_Base::PollEvent() (this=0x5555567088f0) at /home/jgr/openttd/trunk/src/video/sdl2_v.cpp:417
#12 0x0000555555c9cef5 in VideoDriver::Tick() (this=this@entry=0x5555567088f0) at /home/jgr/openttd/trunk/src/video/video_driver.cpp:135
#13 0x0000555555c90d6e in VideoDriver_SDL_Base::LoopOnce() (this=0x5555567088f0) at /home/jgr/openttd/trunk/src/video/sdl2_v.cpp:627
#14 VideoDriver_SDL_Base::LoopOnce() (this=0x5555567088f0) at /home/jgr/openttd/trunk/src/video/sdl2_v.cpp:600
#15 VideoDriver_SDL_Base::MainLoop() (this=0x5555567088f0) at /home/jgr/openttd/trunk/src/video/sdl2_v.cpp:645
#16 0x0000555555f035d8 in openttd_main(int, char**) (argc=<optimised out>, argv=<optimised out>) at /home/jgr/openttd/trunk/src/openttd.cpp:817
#17 0x00007ffff6f82d90 in __libc_start_call_main (main=main@entry=0x5555557cb1b0 <main(int, char**)>, argc=argc@entry=2, argv=argv@entry=0x7fffffffdba8) at ../sysdeps/nptl/libc_start_call_main.h:58
#18 0x00007ffff6f82e40 in __libc_start_main_impl (main=0x5555557cb1b0 <main(int, char**)>, argc=2, argv=0x7fffffffdba8, init=<optimised out>, fini=<optimised out>, rtld_fini=<optimised out>, stack_end=0x7fffffffdb98)
    at ../csu/libc-start.c:392
#19 0x000055555586aa65 in _start ()
PeterN added a commit to PeterN/OpenTTD that referenced this issue Dec 30, 2023
NWidgetMatrix modifies its child widget's index to indicate which element
is to be drawn, which now causes issues with code that does not know about
stuffing extra data into the index.

Instead, let NWidgetMatrix store the currently processing element, and
retrieve this information from the matrix widget while child widgets are
being drawn.

This means only widgets that are children of NWidgetMatrix need to know
anything about their extra data.
@PeterN PeterN closed this as completed in 6215e9b Dec 30, 2023
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

1 participant