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]: EnginePreviewWindow::UpdateWidgetSize crashes when vehicle sprite x_offs exceeds width #12305

Closed
JGRennison opened this issue Mar 15, 2024 · 0 comments

Comments

@JGRennison
Copy link
Contributor

Version of OpenTTD

master

Steps to reproduce

Use a GRF such as HVW trams
Wait until a suitable engine preview window appears

Or fast-forward this save for a bit
Bug Reporting Ltd, 1952-01-06.sav.zip

Upload crash files

openttd: /home/jgr/openttd/trunk/src/gfx.cpp:703: int GetStringHeight(std::string_view, int, FontSize): Assertion `maxw > 0' failed.

#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=140735586932288) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=140735586932288) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=140735586932288, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x00007ffff6f9a476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007ffff6f807f3 in __GI_abort () at ./stdlib/abort.c:79
#5  0x00007ffff6f8071b in __assert_fail_base
    (fmt=0x7ffff7135130 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5555561c5b47 "maxw > 0", file=0x5555561c54c8 "/home/jgr/openttd/trunk/src/gfx.cpp", line=703, function=<optimised out>) at ./assert/assert.c:92
#6  0x00007ffff6f91e96 in __GI___assert_fail (assertion=0x5555561c5b47 "maxw > 0", file=0x5555561c54c8 "/home/jgr/openttd/trunk/src/gfx.cpp", line=703, function=0x5555561c56b8 "int GetStringHeight(std::string_view, int, FontSize)")
    at ./assert/assert.c:101
#7  0x0000555555de17dc in GetStringHeight(std::basic_string_view<char, std::char_traits<char> >, int, FontSize)Python Exception <class 'gdb.error'>: value has been optimised out
 (str=, maxw=<optimised out>, fontsize=<optimised out>) at /home/jgr/openttd/trunk/src/gfx.cpp:703
#8  GetStringHeight(std::basic_string_view<char, std::char_traits<char> >, int, FontSize)Python Exception <class 'gdb.error'>: value has been optimised out
 (str=, maxw=<optimised out>, fontsize=<optimised out>) at /home/jgr/openttd/trunk/src/gfx.cpp:701
#9  0x0000555555de1ade in GetStringHeight(unsigned int, int) (str=str@entry=3346, maxw=-12) at /usr/include/c++/11/string_view:137
#10 0x0000555555daaffc in EnginePreviewWindow::UpdateWidgetSize(int, Dimension*, Dimension const&, Dimension*, Dimension*)
    (this=0x7fff71652060, widget=<optimised out>, size=0x7fff8eaa8598, padding=<optimised out>, fill=<optimised out>, resize=<optimised out>) at /home/jgr/openttd/trunk/src/engine_gui.cpp:103
#11 0x000055555611f9df in NWidgetLeaf::SetupSmallestSize(Window*) (this=0x7fff71652420, w=0x7fff71652060) at /home/jgr/openttd/trunk/src/widget.cpp:2733
#12 0x000055555611e85c in NWidgetVertical::SetupSmallestSize(Window*) (this=0x7fff716523a0, w=0x7fff71652060) at /home/jgr/openttd/trunk/src/widget.cpp:1570
#13 0x000055555611e85c in NWidgetVertical::SetupSmallestSize(Window*) (this=0x7fff71652680, w=0x7fff71652060) at /home/jgr/openttd/trunk/src/widget.cpp:1570
#14 0x000055555611db02 in NWidgetBackground::SetupSmallestSize(Window*) (this=0x7fff71652300, w=0x7fff71652060) at /home/jgr/openttd/trunk/src/widget.cpp:2063
#15 0x000055555611e85c in NWidgetVertical::SetupSmallestSize(Window*) (this=0x7fff716521f0, w=0x7fff71652060) at /home/jgr/openttd/trunk/src/widget.cpp:1570
#16 0x0000555556129d79 in Window::InitializeData(int) (this=this@entry=0x7fff71652060, window_number=window_number@entry=380) at /home/jgr/openttd/trunk/src/window.cpp:1377
#17 0x000055555612a6b6 in Window::FinishInitNested(int) (this=0x7fff71652060, window_number=380) at /home/jgr/openttd/trunk/src/window.cpp:1736
#18 0x000055555612a7c8 in Window::InitNested(int) (this=<optimised out>, window_number=<optimised out>) at /home/jgr/openttd/trunk/src/window.cpp:1750
#19 0x0000555555da86bb in EnginePreviewWindow::EnginePreviewWindow(WindowDesc*, int) (window_number=380, desc=0x555556543b40 <_engine_preview_desc>, this=0x7fff71652060) at /home/jgr/openttd/trunk/src/engine_gui.cpp:75
#20 AllocateWindowDescFront<EnginePreviewWindow>(WindowDesc*, int, bool) (return_existing=false, window_number=380, desc=0x555556543b40 <_engine_preview_desc>) at /home/jgr/openttd/trunk/src/window_gui.h:1014
#21 ShowEnginePreviewWindow(unsigned short) (engine=<optimised out>) at /home/jgr/openttd/trunk/src/engine_gui.cpp:157
#22 0x0000555555da2a34 in operator()<unsigned int> (__closure=<optimised out>) at /home/jgr/openttd/trunk/src/engine.cpp:959
#23 std::__invoke_impl<void, <lambda(auto:47)>&, unsigned int> (__f=<optimised out>) at /usr/include/c++/11/bits/invoke.h:61
#24 std::__invoke_r<void, <lambda(auto:47)>&, unsigned int> (__fn=<optimised out>) at /usr/include/c++/11/bits/invoke.h:111
#25 std::_Function_handler<void(unsigned int), <lambda(auto:47)> >::_M_invoke(const std::_Any_data &, unsigned int &&) (__functor=<optimised out>, __args#0=<optimised out>) at /usr/include/c++/11/bits/std_function.h:290
#26 0x0000555555cc8d56 in std::function<void (unsigned int)>::operator()(unsigned int) const (__args#0=<optimised out>, this=<optimised out>) at /usr/include/c++/11/bits/std_function.h:590
#27 IntervalTimer<TimerGameCalendar>::Elapsed(unsigned int) (this=<optimised out>, trigger=<optimised out>) at /home/jgr/openttd/trunk/src/timer/timer_game_calendar.cpp:81
#28 0x0000555555cc8f7c in TimerManager<TimerGameCalendar>::Elapsed(unsigned int) (delta=delta@entry=1) at /home/jgr/openttd/trunk/src/timer/timer_game_calendar.cpp:143
#29 0x0000555555f43f6c in StateGameLoop() () at /home/jgr/openttd/trunk/src/openttd.cpp:1482
#30 0x0000555555f450c1 in GameLoop() () at /home/jgr/openttd/trunk/src/openttd.cpp:1609
#31 0x0000555555cdd222 in VideoDriver::GameLoop() (this=0x5555567b3790) at /home/jgr/openttd/trunk/src/video/video_driver.cpp:39
#32 0x0000555555cdd2c3 in VideoDriver::GameThread() (this=0x5555567b3790) at /home/jgr/openttd/trunk/src/video/video_driver.cpp:46
#33 0x0000555555cdf792 in StartNewThread<void (*)(VideoDriver*), VideoDriver*>(std::thread*, char const*, void (*&&)(VideoDriver*), VideoDriver*&&)::{lambda(char const*, void (*&&)(VideoDriver*), VideoDriver*&&)#1}::operator()(char const*, void (*&&)(VideoDriver*), VideoDriver*&&) const (__closure=<optimised out>, A#0=<optimised out>, F=<optimised out>, name=0x55555619a4f6 "ottd:game") at /home/jgr/openttd/trunk/src/video/../thread.h:65
#34 std::__invoke_impl<void, StartNewThread<void (*)(VideoDriver*), VideoDriver*>(std::thread*, char const*, void (*&&)(VideoDriver*), VideoDriver*&&)::{lambda(char const*, void (*&&)(VideoDriver*), VideoDriver*&&)#1}, char const*, void (*)(VideoDriver*), VideoDriver*>(std::__invoke_other, StartNewThread<void (*)(VideoDriver*), VideoDriver*>(std::thread*, char const*, void (*&&)(VideoDriver*), VideoDriver*&&)::{lambda(char const*, void (*&&&&)(VideoDriver*), VideoDriver*&&)#1}, char const*&&, void (*&&)(VideoDriver*), VideoDriver*&&) (__f=<optimised out>) at /usr/include/c++/11/bits/invoke.h:61
#35 _ZSt8__invokeIZ14StartNewThreadIPFvP11VideoDriverEJS2_EEbPSt6threadPKcOT_DpOT0_EUlS8_OS4_OS2_E_JS8_S4_S2_EENSt15__invoke_resultIS9_JDpSB_EE4typeESA_SD_ (__fn=<optimised out>) at /usr/include/c++/11/bits/invoke.h:96
#36 std::thread::_Invoker<std::tuple<StartNewThread<void (*)(VideoDriver*), VideoDriver*>(std::thread*, char const*, void (*&&)(VideoDriver*), VideoDriver*&&)::{lambda(char const*, void (*&&)(VideoDriver*), VideoDriver*&&)#1}, char const*, void (*)(VideoDriver*), VideoDriver*> >::_M_invoke<0ul, 1ul, 2ul, 3ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul>) (this=<optimised out>) at /usr/include/c++/11/bits/std_thread.h:259
#37 std::thread::_Invoker<std::tuple<StartNewThread<void (*)(VideoDriver*), VideoDriver*>(std::thread*, char const*, void (*&&)(VideoDriver*), VideoDriver*&&)::{lambda(char const*, void (*&&)(VideoDriver*), VideoDriver*&&)#1}, char const*, void (*)(VideoDriver*), VideoDriver*> >::operator()() (this=<optimised out>) at /usr/include/c++/11/bits/std_thread.h:266
#38 std::thread::_State_impl<std::thread::_Invoker<std::tuple<StartNewThread<void (*)(VideoDriver*), VideoDriver*>(std::thread*, char const*, void (*&&)(VideoDriver*), VideoDriver*&&)::{lambda(char const*, void (*&&)(VideoDriver*), VideoDriver*&&)#1}, char const*, void (*)(VideoDriver*), VideoDriver*> > >::_M_run() (this=0x5555567ab210) at /usr/include/c++/11/bits/std_thread.h:211
#39 0x00007ffff7364253 in  () at /lib/x86_64-linux-gnu/libstdc++.so.6
#40 0x00007ffff6fecac3 in start_thread (arg=<optimised out>) at ./nptl/pthread_create.c:442
#41 0x00007ffff707e850 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
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