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

Recursive mutex locking for SDL drawing when switching blitter in game #5787

Closed
DorpsGek opened this issue Oct 12, 2013 · 2 comments
Closed
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

frosch opened the ticket and wrote:

When changing NewGRF in game, the blitter might be switched.

Switching of the blitter is triggered during the processing of the mouse click.
However, _draw_mutex is locked during VideoDriver_SDL::PollEvent. VideoDriver_SDL::ChangeResolution then tries to lock it again.

# 6 0x00007f648769a621 in *__GI___assert_fail (assertion=0xe0bf79 "err == 0", file=, line=122, function=0xe0c0e0 "virtual void ThreadMutex_pthread::BeginCritical()") at assert.c:81
# 7 0x0000000000a22072 in ThreadMutex_pthread::BeginCritical (this=0x36014f0) at /home/frosch/daten/ottd/trunk/hgtrunk8/src/thread/thread_pthread.cpp:122
# 8 0x0000000000a85639 in VideoDriver_SDL::ChangeResolution (this=0x35eba00, w=1826, h=936) at /home/frosch/daten/ottd/trunk/hgtrunk8/src/video/sdl_v.cpp:820
# 9 0x0000000000a85729 in VideoDriver_SDL::AfterBlitterChange (this=0x35eba00) at /home/frosch/daten/ottd/trunk/hgtrunk8/src/video/sdl_v.cpp:840
# 10 0x00000000007b442b in SwitchNewGRFBlitter () at /home/frosch/daten/ottd/trunk/hgtrunk8/src/gfxinit.cpp:245
# 11 0x00000000007b44bc in GfxLoadSprites () at /home/frosch/daten/ottd/trunk/hgtrunk8/src/gfxinit.cpp:258
# 12 0x0000000000951af4 in ReloadNewGRFData () at /home/frosch/daten/ottd/trunk/hgtrunk8/src/saveload/afterload.cpp:2864
# 13 0x000000000088c5c5 in NewGRFConfirmationCallback (w=0x3be8970, confirmed=true) at /home/frosch/daten/ottd/trunk/hgtrunk8/src/newgrf_gui.cpp:1904
# 14 0x00000000008186bb in QueryWindow::OnClick (this=0x50ae430, pt=..., widget=3, click_count=1) at /home/frosch/daten/ottd/trunk/hgtrunk8/src/misc_gui.cpp:1121
# 15 0x0000000000aab9a1 in DispatchLeftClickEvent (w=0x50ae430, x=162, y=168, click_count=1) at /home/frosch/daten/ottd/trunk/hgtrunk8/src/window.cpp:738
# 16 0x0000000000ab0a3f in MouseLoop (click=MC_LEFT, mousewheel=0) at /home/frosch/daten/ottd/trunk/hgtrunk8/src/window.cpp:2827
# 17 0x0000000000ab0e2b in HandleMouseEvents () at /home/frosch/daten/ottd/trunk/hgtrunk8/src/window.cpp:2916
# 18 0x0000000000a84e34 in VideoDriver_SDL::PollEvent (this=0x35eba00) at /home/frosch/daten/ottd/trunk/hgtrunk8/src/video/sdl_v.cpp:584
# 19 0x0000000000a8523d in VideoDriver_SDL::MainLoop (this=0x35eba00) at /home/frosch/daten/ottd/trunk/hgtrunk8/src/video/sdl_v.cpp:720
# 20 0x00000000008bccc7 in openttd_main (argc=1, argv=0x7fff96f42788) at /home/frosch/daten/ottd/trunk/hgtrunk8/src/openttd.cpp:857
# 21 0x00000000008d4516 in main (argc=1, argv=0x7fff96f42788) at /home/frosch/daten/ottd/trunk/hgtrunk8/src/os/unix/unix.cpp:275

Reported version: trunk
Operating system: Linux


This issue was imported from FlySpray: https://bugs.openttd.org/task/5787
@DorpsGek
Copy link
Member Author

DorpsGek commented Nov 8, 2013

Rubidium wrote:

This seems to fix it, and I'm fairly certain that all paths leading to AfterBlitterChange are initiated from an event (and thus hold the mutex). Need someone to verify that though.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/5787#comment12729

@DorpsGek
Copy link
Member Author

Rubidium closed the ticket.

Reason for closing: Fixed

In r25970


This comment was imported from FlySpray: https://bugs.openttd.org/task/5787

@DorpsGek DorpsGek added Core flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) labels Apr 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

1 participant