wesnoth icon indicating copy to clipboard operation
wesnoth copied to clipboard

wesnoth 1.17 crashes in Credits

Open grz0 opened this issue 3 years ago • 4 comments

Game and System Information

The Battle for Wesnoth version 1.17.6+dev (54fedb4d6a8-Clean) x86_64 Running on Fedora Linux 36 (Workstation Edition) x86_64 Distribution channel: Default

reproduced also on latest nightly flatpak

Description of the bug

20220807 16:03:21 error draw/manager: Attempted to invalidate region [0,0|1920,1017] during draw
terminate called after throwing an instance of 'game::error'
  what():  invalidate during draw
Aborted (core dumped)
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0)
    at pthread_kill.c:44
#1  0x00007f0504e3ccb3 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
#2  0x00007f0504dec9c6 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007f0504dd67f4 in __GI_abort () at abort.c:79
#4  0x00007f0505152b57 in __gnu_cxx::__verbose_terminate_handler() ()
    at ../../../../libstdc++-v3/libsupc++/vterminate.cc:95
#5  0x00007f050515e43c in __cxxabiv1::__terminate(void (*)()) (handler=<optimized out>)
    at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:48
#6  0x00007f050515d4a9 in __cxa_call_terminate(_Unwind_Exception*) (ue_header=0x56248b7f9a50)
    at ../../../../libstdc++-v3/libsupc++/eh_call.cc:54
#7  0x00007f050515dbc6 in __cxxabiv1::__gxx_personality_v0(int, _Unwind_Action, _Unwind_Exception_Class, _Unwind_Exception*, _Unwind_Context*)
    (version=<optimized out>, actions=6, exception_class=5138137972254386944, ue_header=<optimized out>, context=0x7ffe883850c0) at ../../../../libstdc++-v3/libsupc++/eh_personality.cc:688
#8  0x00007f0504fc6c74 in _Unwind_RaiseException_Phase2
    (exc=0x56248b7f9a50, context=0x7ffe883850c0, frames_p=0x7ffe883851b0) at ../../../libgcc/unwind.inc:64
#9  0x00007f0504fc7331 in _Unwind_RaiseException (exc=0x56248b7f9a50) at ../../../libgcc/unwind.inc:136
#10 0x00007f050515e6fb in __cxxabiv1::__cxa_throw(void*, std::type_info*, void (*)(void*))
    (obj=<optimized out>, tinfo=0x562483f676b0 <typeinfo for game::error>, dest=0x562482e2a8f0 <game::error::~error()>) at ../../../../libstdc++-v3/libsupc++/eh_throw.cc:93
#11 0x0000562482cc2b58 in draw_manager::invalidate_region(rect const&) [clone .cold] ()
#12 0x000056248316a196 in gui2::widget::queue_redraw() ()
#13 0x0000562482ee40db in gui2::window::~window() ()
#14 0x0000562482ef62ce in void gui2::dialogs::end_credits::display<>() ()
#15 0x0000562482d7eb14 in main ()

Steps to reproduce the behavior

  1. Click 'Credits'

Expected behavior

No response

Additional context

No response

grz0 avatar Aug 07 '22 14:08 grz0

The backtrace is spurious but this does crash. 5129d61dd2f46c86854f81fe2badc893c523673c should fix the misleading backtrace.

Related: #6845

mesilliac avatar Aug 09 '22 03:08 mesilliac

I compiled wesnoth with https://github.com/wesnoth/wesnoth/commit/5129d61dd2f46c86854f81fe2badc893c523673c, now game exits with err code 1 and following message:

20220809 19:43:31 warning draw/manager: exception thrown during expose 0x7ffecdc54d50
Caught general 'St12length_error' exception:
Text is too long to render

grz0 avatar Aug 09 '22 17:08 grz0

Retitled to separate this from #6845, which has been reported in 1.16.x. In 1.16, src/gui/core/canvas.cpp's text_shape::draw clips the rendering to the visible screen area. In 1.17, the issue is that 2931615cdfbb12c6c0b04f1923807df1165806ff has removed that clipping, and IIUC @Vultraz is going to add a redesigned text-cache instead.

stevecotton avatar Aug 14 '22 08:08 stevecotton

I confirm on 1.17.7+dev (314f6f7c78d), same error message as what grz0 quoted.

Wedge009 avatar Aug 28 '22 12:08 Wedge009

Still confirmed on 1.17.9+dev

20221110 17:20:10 warning draw/manager: exception std::length_error thrown during expose 0x11493fdec0
Caught general 'St12length_error' exception:
Text is too long to render

knyghtmare avatar Nov 10 '22 09:11 knyghtmare

Yes, it's still there. As steve mentioned, the commit that caused the crash (even says so in the commit message) is 2931615cdfbb12c6c0b04f1923807df1165806ff.

Wedge009 avatar Nov 10 '22 09:11 Wedge009

Reverting just the src/gui/core/canvas.cpp changes from 2931615 doesn't work. It stops the crash, but only renders the first few lines (so most of the scrolling area is blank).

stevecotton avatar Nov 10 '22 20:11 stevecotton

Vultraz said that he would fix this. It was impossible to cleanly separate out the breaking changes in it from everything else. It's caused by his changes to rendered text caching that render and cache the whole text blob in stead of rerendering the currently viewable portion every scroll tick. Credits are too long to render all at once, as it would create too tall a rendering surface. I believe cairo is throwing an exception when asked to do so.

mesilliac avatar Nov 17 '22 06:11 mesilliac

I tried to reapply f282eb7948's method to the current canvas.cpp, and found that draw::fill and draw::blit behave oddly in the credits screen's scroll_label. Although the width of rectangles passed to them is used (as a drawing-space width), the height appears to be also scaled by the amount needed for the whole scroll_label to fit on screen. If there's enough text to fill 5 screen-height pages of text, then the height is effectively divided by 5.

The commit that's auto-linked today (efa1fa9) demonstrates this.

stevecotton avatar Mar 09 '23 14:03 stevecotton

That PR wasn't supposed to close this.

CelticMinstrel avatar Mar 09 '23 14:03 CelticMinstrel