[Scummvm-tracker] [ScummVM :: Bugs] #14638: SWORD1: Crashes due to data races (multi-threading)

ScummVM :: Bugs trac at scummvm.org
Sun Sep 24 23:23:27 UTC 2023


#14638: SWORD1: Crashes due to data races (multi-threading)
-------------------------+-----------------------------
Reporter:  PushmePullyu  |       Owner:  AndywinXp
    Type:  defect        |      Status:  pending
Priority:  normal        |   Component:  Engine: Sword1
 Version:                |  Resolution:  fixed
Keywords:                |        Game:  Broken Sword 1
-------------------------+-----------------------------
Comment (by PushmePullyu):

 Just tested !2ab1385183bada86a72577ed67b2e82574717be1, sorry for the
 delay.

 Unfortunately I still get this crash:
 "ERROR: SDL_BlitSurface failed: Surfaces must not be locked during blit!"

 The locking happens from the SDLTimer thread in blitCursor()
 (backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2284):

 {{{
 SDL_LockSurface(_mouseSurface);
 }}}


 Backtrace:
 Thread 21 "SDLTimer"
 {{{
 #0  SDL_LockSurface_REAL (surface=0x2bc45c0) at
 /usr/src/debug/SDL2-2.26.3-1.fc37.x86_64/src/video/SDL_surface.c:1121
 #1  0x00000000006d56de in SurfaceSdlGraphicsManager::blitCursor()
 (this=0x1823910) at backends/graphics/surfacesdl/surfacesdl-
 graphics.cpp:2284
 #2  0x00000000006d3985 in SurfaceSdlGraphicsManager::setPalette(unsigned
 char const*, unsigned int, unsigned int) (this=0x1823910,
 colors=0x7fffd8bf9870 "", start=0, num=256)
     at backends/graphics/surfacesdl/surfacesdl-graphics.cpp:1803
 #3  0x00000000005e2395 in Sword1::Screen::fadePalette() (this=0x2abbfe0)
 at engines/sword1/screen.cpp:284
 #4  0x00000000005c0fc5 in Sword1::SwordEngine::fadePaletteStep()
 (this=0x27c79c0) at engines/sword1/sword1.cpp:1187
 #5  0x00000000005c112c in Sword1::vblCallback(void*) (refCon=0x27c79c0) at
 engines/sword1/sword1.cpp:1223
 #6  0x00000000006e8b43 in DefaultTimerManager::handler() (this=0x1814fc0)
 at backends/timer/default/default-timer.cpp:110
 #7  0x00000000006d94b9 in timer_handler(Uint32, void*) (interval=10,
 param=0x1814fc0) at backends/timer/sdl/sdl-timer.cpp:32
 #8  0x00007ffff7e5e595 in SDL_TimerThread (_data=0x7ffff7f981e0
 <SDL_timer_data>) at
 /usr/src/debug/SDL2-2.26.3-1.fc37.x86_64/src/timer/SDL_timer.c:168
 #9  0x00007ffff7f07687 in SDL_RunThread (thread=0x16d4d10) at
 /usr/src/debug/SDL2-2.26.3-1.fc37.x86_64/src/thread/SDL_thread.c:305
 #10 RunThread (data=0x16d4d10) at
 /usr/src/debug/SDL2-2.26.3-1.fc37.x86_64/src/thread/pthread/SDL_systhread.c:77
 #11 0x00007ffff72ae15d in start_thread (arg=<optimized out>) at
 pthread_create.c:442
 #12 0x00007ffff732fc00 in clone3 () at
 ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
 }}}

 The error occurs here:
 Thread 1 "scummvm"
 {{{
 ...
 #14 0x00000000009a735c in error(char const*, ...) (s=0x12f7637
 "SDL_BlitSurface failed: %s") at common/textconsole.cpp:100
 #15 0x00000000006d60a7 in SurfaceSdlGraphicsManager::drawMouse()
 (this=0x1823910) at backends/graphics/surfacesdl/surfacesdl-
 graphics.cpp:2395
 #16 0x00000000006d23cf in SurfaceSdlGraphicsManager::internUpdateScreen()
 (this=0x1823910) at backends/graphics/surfacesdl/surfacesdl-
 graphics.cpp:1401
 #17 0x00000000006d1557 in SurfaceSdlGraphicsManager::updateScreen()
 (this=0x1823910) at backends/graphics/surfacesdl/surfacesdl-
 graphics.cpp:1142
 #18 0x00000000006b09a4 in ModularGraphicsBackend::updateScreen()
 (this=0x14b4560) at backends/modular-backend.cpp:187
 #19 0x00000000005e2fab in Sword1::Screen::updateScreen() (this=0x2abbfe0)
 at engines/sword1/screen.cpp:433
 #20 0x00000000005c092d in Sword1::SwordEngine::mainLoop() (this=0x27c79c0)
 at engines/sword1/sword1.cpp:1057
 #21 0x00000000005bf800 in Sword1::SwordEngine::go() (this=0x27c79c0) at
 engines/sword1/sword1.cpp:738
 #22 0x00000000005c12ce in Sword1::SwordEngine::run() (this=0x27c79c0) at
 ./engines/sword1/sword1.h:138
 #23 0x0000000000447fdf in runGame(Plugin const*, Plugin const*, OSystem&,
 Common::String const&) (plugin=0x15f58a0, enginePlugin=0x1590410,
 system=..., debugLevels=...) at base/main.cpp:324
 #24 0x0000000000449f71 in scummvm_main(int, char const* const*) (argc=1,
 argv=0x7fffffffde78) at base/main.cpp:764
 #25 0x0000000000445370 in main(int, char**) (argc=1, argv=0x7fffffffde78)
 at backends/platform/sdl/posix/posix-main.cpp:44
 }}}

 This should help in reproducing the bug:

 {{{
 index a18ef063519..22f0e960335 100644
 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
 +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
 @@ -2282,7 +2282,7 @@ void SurfaceSdlGraphicsManager::blitCursor() {

         SDL_LockSurface(_mouseOrigSurface);
         SDL_LockSurface(_mouseSurface);
 -
 +       g_system->delayMillis(10);
         // If possible, use the same scaler for the cursor as for the rest
 of
         // the game. This only works well with the non-blurring scalers so
 we
         // otherwise use the Normal scaler
 }}}
-- 
Ticket URL: <https://bugs.scummvm.org/ticket/14638#comment:4>
ScummVM :: Bugs <https://bugs.scummvm.org>
ScummVM


More information about the Scummvm-tracker mailing list