I can second that. Happens with 0.96.4 and 0.97.0. Built from source, Gentoo Linux, x64.
Here's the gdb backtrace for 0.97.0:
Thread1"dunelegacy"receivedsignalSIGSEGV,Segmentationfault.0x00007ffff7edb677inBlit_3or4_to_3or4__inversed_rgb(info=<optimizedout>)at/usr/src/debug/media-libs/libsdl2-2.0.16-r1/SDL2-2.0.16/src/video/SDL_blit_N.c:31733173DUFFS_LOOP((gdb)backtrace#0 0x00007ffff7edb677 in Blit_3or4_to_3or4__inversed_rgb (info=<optimized out>) at /usr/src/debug/media-libs/libsdl2-2.0.16-r1/SDL2-2.0.16/src/video/SDL_blit_N.c:3173#1 0x00007ffff7ebd127 in SDL_SoftBlit (src=0x7fffffff5ef0, srcrect=0x7fffffff5ee0, dst=0x7fffffff5f50, dstrect=0x7fffffff5ee0) at /usr/src/debug/media-libs/libsdl2-2.0.16-r1/SDL2-2.0.16/src/video/SDL_blit.c:88#2 0x00007ffff7ef4083 in SDL_LowerBlit_REAL (src=src@entry=0x7fffffff5ef0, srcrect=srcrect@entry=0x7fffffff5ee0, dst=dst@entry=0x7fffffff5f50, dstrect=dstrect@entry=0x7fffffff5ee0)at/usr/src/debug/media-libs/libsdl2-2.0.16-r1/SDL2-2.0.16/src/video/SDL_surface.c:636#3 0x00007ffff7ef47b9 in SDL_ConvertPixels_REAL (width=1920, height=1080, src_format=src_format@entry=372645892, src=src@entry=0x7fffe12ce010, src_pitch=src_pitch@entry=7680, dst_format=4294926384, dst_format@entry=376840196, dst=0x55555a6e5620,dst_pitch=3840)at/usr/src/debug/media-libs/libsdl2-2.0.16-r1/SDL2-2.0.16/src/video/SDL_surface.c:1433#4 0x00007ffff7e9949c in GL_RenderReadPixels (renderer=<optimized out>, rect=<optimized out>, pixel_format=<optimized out>, pixels=<optimized out>, pitch=<optimized out>)at/usr/src/debug/media-libs/libsdl2-2.0.16-r1/SDL2-2.0.16/src/render/opengl/SDL_render_gl.c:1449#5 0x00007ffff7e94f82 in SDL_RenderReadPixels_REAL (renderer=0x555555f6aaf0, rect=0x0, format=376840196, pixels=0x55555a6e5620, pitch=3840) at /usr/src/debug/media-libs/libsdl2-2.0.16-r1/SDL2-2.0.16/src/render/SDL_render.c:3323#6 0x00007ffff7e7ba5d in SDL_RenderReadPixels (a=<optimized out>, b=<optimized out>, c=<optimized out>, d=<optimized out>, e=<optimized out>) at /usr/src/debug/media-libs/libsdl2-2.0.16-r1/SDL2-2.0.16/src/dynapi/SDL_dynapi_procs.h:376#7 0x00005555556caa76 in renderReadSurface (renderer=0x555555f6aaf0) at misc/draw_util.cpp:183#8 0x000055555564529c in Game::takeScreenshot (this=<optimized out>) at Game.cpp:2473#9 0x0000555555652512 in Game::doInput (this=0x555559c29430) at Game.cpp:591#10 0x000055555565366c in Game::runMainLoop (this=<optimized out>) at Game.cpp:1182#11 0x000055555568a28a in startSinglePlayerGame (init=...) at sand.cpp:685#12 0x00005555557ee9b7 in SinglePlayerMenu::onChildWindowClose (this=0x7fffffffaaf0, pChildWindow=0x7fffffffa820) at Menu/SinglePlayerMenu.cpp:173#13 0x0000555555700748 in Window::processChildWindowOpenCloses (this=this@entry=0x7fffffffaaf0) at GUI/Window.cpp:80#14 0x00005555557007ce in Window::handleInput (this=0x7fffffffaaf0, event=...) at GUI/Window.cpp:103#15 0x00005555557eabc7 in MenuBase::doInput (this=0x7fffffffaaf0, event=...) at Menu/MenuBase.cpp:176#16 0x00005555557ea9ff in MenuBase::showMenu (this=this@entry=0x7fffffffaaf0) at Menu/MenuBase.cpp:77#17 0x00005555557ecc30 in MainMenu::onSinglePlayer (this=<optimized out>) at Menu/MainMenu.cpp:114#18 0x00005555556fe581 in std::function<void ()>::operator()() const (this=0x7fffffffbfb8) at /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/g++-v11/bits/std_function.h:560#19 Button::handleMouseLeft (x=<optimized out>, y=<optimized out>, pressed=false, this=0x7fffffffbef8) at GUI/Button.cpp:76#20 Button::handleMouseLeft (this=0x7fffffffbef8, x=<optimized out>, y=<optimized out>, pressed=<optimized out>) at GUI/Button.cpp:48#21 0x0000555555669820 in Container<VBox_WidgetData>::handleMouseLeft (this=0x7fffffffbe68, x=101, y=11, pressed=false) at ../include/GUI/Container.h:109#22 0x0000555555667692 in Container<StaticContainer_WidgetData>::handleMouseLeft (this=0x7fffffffbdd8, x=501, y=345, pressed=false) at ../include/GUI/Container.h:109#23 0x00005555556fff22 in Window::handleMouseLeft (pressed=false, y=345, x=501, this=0x7fffffffbce0) at GUI/Window.cpp:176#24 Window::handleMouseLeft (this=0x7fffffffbce0, x=501, y=345, pressed=<optimized out>) at GUI/Window.cpp:169#25 0x00005555557eabc7 in MenuBase::doInput (this=0x7fffffffbce0, event=...) at Menu/MenuBase.cpp:176#26 0x00005555557ea9ff in MenuBase::showMenu (this=this@entry=0x7fffffffbce0) at Menu/MenuBase.cpp:77#27 0x00005555557ecbf2 in MainMenu::showMenu (this=this@entry=0x7fffffffbce0) at Menu/MainMenu.cpp:108#28 0x000055555560921a in main (argc=1, argv=0x7fffffffd7e8) at main.cpp:710
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think these crashes are because SDL_RenderReadPixels() is sometimes called with too small of a buffer. getRenderSize() (usually) returns the logical size of the screen, which can be much smaller than what SDL_RenderReadPixels() expects.
The 6bb773 commit resolves that particular problem over in my fork. Unfortunately, there are some other issues as well. The image is saved to the current directory which is typically not writable without admin rights on Windows. The read from the screen itself can fail if the renderer doesn't support the operation (e.g., the "direct3d11" renderer fails). There isn't enough error checking to prevent other null dereferences in these cases. The 714356 commit resolves those issues, but uses the vastly diverged fnkdat() to put the screenshots in the user's directory near the saved games and such.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Does Ctrl + P work? What is logged to Dune Legacy.log?
Ctrl+P also leads to a crash. The log file ends with "Now playing DUNE7.ADL!", which is already present before provoking the crash.
I can second that. Happens with 0.96.4 and 0.97.0. Built from source, Gentoo Linux, x64.
Here's the gdb backtrace for 0.97.0:
I think these crashes are because
SDL_RenderReadPixels()is sometimes called with too small of a buffer.getRenderSize()(usually) returns the logical size of the screen, which can be much smaller than whatSDL_RenderReadPixels()expects.The 6bb773 commit resolves that particular problem over in my fork. Unfortunately, there are some other issues as well. The image is saved to the current directory which is typically not writable without admin rights on Windows. The read from the screen itself can fail if the renderer doesn't support the operation (e.g., the "direct3d11" renderer fails). There isn't enough error checking to prevent other null dereferences in these cases. The 714356 commit resolves those issues, but uses the vastly diverged
fnkdat()to put the screenshots in the user's directory near the saved games and such.