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

ScummVM :: Bugs trac at scummvm.org
Sat Sep 30 15:06:31 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):

 Preliminary results for !c99265cf9725b8ec32698b83088fe2c8f304749f

 I observed no concurrent blitting or memMan access anymore and only saw a
 single crash, which I could not reproduce so far.
 It happened while spam clicking and moving the mouse in and out of the
 inventory bar:

 (Line numbers will be different).
 {{{
 Thread 21 "SDLTimer" received signal SIGSEGV, Segmentation fault.

 0x000000000048887d in READ_UINT32 (ptr=0x14) at ./common/endian.h:214
 214                     return ((const Unaligned32 *)ptr)->val;

 #0  0x000000000048887d in READ_UINT32(void const*) (ptr=0x14) at
 ./common/endian.h:214
 #1  Sword1::ResMan::fetchFrame(void*, unsigned int) (this=0x17d0900,
 resourceData=0x0, frameNo=3640146302) at engines/sword1/resman.cpp:298
 #2  0x00000000004961ba in Sword1::Screen::showFrame(unsigned short,
 unsigned short, unsigned int, unsigned int, unsigned char const*, signed
 char)
     (this=0x19770e0, x=3600, y=440, resId=0, frameNo=3640146302,
 fadeMask=0x10ae1e0 <Sword1::Menu::_fadeEffectTop>
 "\001\a\005\003\002\004\006", fadeStatus=2 '\002')
     at engines/sword1/screen.cpp:1451
 #3  0x0000000000482a10 in Sword1::MenuIcon::draw(unsigned char const*,
 signed char)
     (this=0x2812800, fadeMask=0x10ae1e0 <Sword1::Menu::_fadeEffectTop>
 "\001\a\005\003\002\004\006", fadeStatus=2 '\002') at
 engines/sword1/menu.cpp:88
 #4  0x00000000004833ca in Sword1::Menu::refresh(unsigned char)
 (this=0x193b410, menuType=0 '\000') at engines/sword1/menu.cpp:243
 #5  0x000000000046f14a in Sword1::SwordEngine::updateTopMenu()
 (this=0x25d9280) at engines/sword1/sword1.cpp:1186
 #6  0x000000000046f2ae in Sword1::vblCallback(void*) (refCon=0x25d9280) at
 engines/sword1/sword1.cpp:1221
 }}}


 Possible cause:
 Both threads accessing Sword1::Menu::_objects[]


 {{{
 Main thread
 #0  Sword1::Menu::buildMenu() (this=0x21d39c0) at
 engines/sword1/menu.cpp:321
 #1  0x0000000000483a16 in Sword1::Menu::fnStartMenu() (this=0x21d39c0) at
 engines/sword1/menu.cpp:344
 #2  0x00000000004840a2 in Sword1::Mouse::engine(unsigned short, unsigned
 short, unsigned short) (this=0x25bc5c0, x=132, y=16, eventFlags=2) at
 engines/sword1/mouse.cpp:123
 #3  0x000000000046ebe9 in Sword1::SwordEngine::mainLoop() (this=0x25bee30)
 at engines/sword1/sword1.cpp:1077
 #4  0x000000000046d988 in Sword1::SwordEngine::go() (this=0x25bee30) at
 engines/sword1/sword1.cpp:739

 Timer thread
 #0  Sword1::Menu::refresh(unsigned char) (this=0x21d39c0, menuType=0
 '\000') at engines/sword1/menu.cpp:234
 #1  0x000000000046f14a in Sword1::SwordEngine::updateTopMenu()
 (this=0x25bee30) at engines/sword1/sword1.cpp:1186
 #2  0x000000000046f2ae in Sword1::vblCallback(void*) (refCon=0x25bee30) at
 engines/sword1/sword1.cpp:1221
 }}}

 I'll see if I can find anything else.
-- 
Ticket URL: <https://bugs.scummvm.org/ticket/14638#comment:11>
ScummVM :: Bugs <https://bugs.scummvm.org>
ScummVM


More information about the Scummvm-tracker mailing list