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

The game suddenly crashes within allegro 5 when a picture is being shaded #70

Closed
hendrikbez opened this issue May 7, 2024 · 9 comments

Comments

@hendrikbez
Copy link

Is there a way to see what happened when the game crashed

@hendrikbez
Copy link
Author

This is all dump I could found
headoverheels.exe.zip

@dougmencken
Copy link
Owner

dougmencken commented May 7, 2024

it crashed at allegro-5.2.dll+0x48B5

Is there a way to see what happened when the game crashed

yeah, try to run the game via the GNU debugger, gdb

gdb /hoh/bin/headoverheels.exe

then type run there at the gdb prompt

when a crash happens, at the same prompt type bt to get a backtrace

if that's something after getPixel then this is a known issue with allegro 5 and possible over-locking of pictures when they are being shaded

@hendrikbez
Copy link
Author

hendrikbez commented May 7, 2024

Did play with debugger and did get this from it

Thread 1 "headoverheels" received signal SIGSEGV, Segmentation fault.
0x00007ffaebd548b5 in ?? () from /c/hoh/bin/allegro-5.2.dll
(gdb) vt
Undefined command: "vt".  Try "help".
(gdb) bt
#0  0x00007ffaebd548b5 in ?? () from /c/hoh/bin/allegro-5.2.dll
#1  0x0000000100404a66 in allegro::Pict::getPixelAt (this=<optimized out>, x=x@entry=24,
    y=y@entry=15) at WrappersAllegro.cpp:301
#2  0x000000010043b392 in Picture::getPixelAt (y=<optimized out>, x=24, this=0x7ffffc330)
    at /home/User-Pc/headoverheels-git/source/Picture.hpp:50
#3  ShadowCaster::castShadowOnFloor (tile=..., x=x@entry=89, y=y@entry=447, shadow=...,
    shading=shading@entry=128, transparency=transparency@entry=0 '\000') at ShadowCaster.cpp:347
#4  0x0000000100440243 in Mediator::castShadowOnFloor (this=0xa00210000, floorTile=...)
    at Mediator.cpp:403
#5  0x000000010044abd4 in Room::draw (this=0xa0020df80) at Room.cpp:1282
#6  0x0000000100449c5e in Drawable::drawOn (where=..., this=0xa0020df80)
    at /home/User-Pc/headoverheels-git/source/Drawable.hpp:32
#7  Drawable::drawOn (where=..., this=0xa0020df80)
    at /home/User-Pc/headoverheels-git/source/Drawable.hpp:25
#8  Room::drawRoom (this=0xa0020df80) at Room.cpp:1260
#9  0x000000010047c041 in Isomot::updateMe (
    this=this@entry=0x100518a90 <GameManager::instance+240>) at Isomot.cpp:201
#10 0x00000001004674c6 in GameManager::update (this=0x1005189a0 <GameManager::instance>)
    at GameManager.cpp:155
#11 0x000000010046796e in GameManager::begin (this=<optimized out>) at GameManager.cpp:119
#12 0x00000001004c7bc5 in gui::ContinueGame::act (this=0xa00125d00)
    at guiactions/ContinueGame.cpp:35
#13 0x00000001004b5c35 in gui::Action::doIt (this=0xa00125d00) at guiactions/Action.hpp:34
#14 gui::Label::handleKey (this=<optimized out>, key=...) at gui/Label.cpp:62
#15 0x00000001004b2d97 in gui::GuiManager::begin (this=0xa00036df0) at gui/GuiManager.cpp:124
#16 0x00000001004f0844 in main (argc=<optimized out>, argv=<optimized out>) at main.cpp:213
(gdb)

@dougmencken
Copy link
Owner

dougmencken commented May 7, 2024

Picture::getPixelAt at Picture.hpp:50

ShadowCaster::castShadowOnFloor at ShadowCaster.cpp:347

exactly where I expected 😏😤

currently you can toggle drawing the shadows off in the menus : options –> adjust graphics –> draw shadows

@dougmencken dougmencken changed the title Game crashed, when playing for a few minutes Crash possibly due to picture over-locking with allegro 5 when a picture is being shaded May 7, 2024
@dougmencken
Copy link
Owner

at first I will make three two functions lockReadOnly(), lockWriteOnly(), lockReadWrite() out of that single lock(bool, bool)
reading more throughly what allegro 5 docs say about al_lock_bitmap

then I’ll try to get rid of the line

AllegroColor resultColor = shadyTile.getPixelAt( tilePixel, tileRow );

together with resultColor.equalsRGB( tileColor ) there on

if ( ! shadowColor.isKeyColor() && ! tileColor.isKeyColor() && resultColor.equalsRGB( tileColor ) )

dougmencken added a commit that referenced this issue May 10, 2024
…ibidem

   all of this is expected to solve the issue #70
@dougmencken
Copy link
Owner

dougmencken commented May 10, 2024

@hendrikbez can you please test the current master for having zero segfaults when shadows are on ?

@dougmencken dougmencken changed the title Crash possibly due to picture over-locking with allegro 5 when a picture is being shaded The game suddenly crashes within allegro 5 when a picture is being shaded May 10, 2024
@hendrikbez
Copy link
Author

Will test it today, was busy with other things yesterday

@hendrikbez
Copy link
Author

Tested it and it does not crash on shadows anymore.

@dougmencken
Copy link
Owner

Tested it and it does not crash on shadows anymore.

Excellent. Such sudden crashes are very frustrating. I’m closing this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants