Game Client Crash. (Part 2!)

Ask for help regarding any technical issue or report any bug or OS independent issues.
Post Reply
User avatar
Pauan
Novice
Novice
Posts: 236
Joined: 15 Aug 2006, 08:28
Contact:

Game Client Crash. (Part 2!)

Post by Pauan » 22 Aug 2006, 15:32

(I apologize in advance to Bjorn if this post is too long. :wink: )

Thanks to Bjorn's advice and help, I got the debug client working. Lo and behold... it crashed! My guess is that I'm missing some sort of graphic file (tile, sprite, etc.) that somebody put in, but I never got. Either way, here is the code:

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1219119424 (LWP 27004)]
0x080e6299 in Graphics::drawImage (this=0x8133918, image=0x0, x=448, y=288)
    at graphics.cpp:123
123     graphics.cpp: No such file or directory.
        in graphics.cpp
(gdb) bt
#0  0x080e6299 in Graphics::drawImage (this=0x8133918, image=0x0, x=448, y=288)
    at graphics.cpp:123
#1  0x080e1d86 in FloorItem::draw (this=0x8334d70, graphics=0x8133918,
    offsetX=-544, offsetY=-1248) at floor_item.h:93
#2  0x080ef2ef in Map::draw (this=0x822ca70, graphics=0x8133918, scrollX=544,
    scrollY=1248, layer=1) at map.cpp:135
#3  0x080df5b0 in Engine::draw (this=0x81d0f60, graphics=0x8133918)
    at engine.cpp:203
#4  0x080e3bf8 in Game::logic (this=0x812e408) at game.cpp:377
#5  0x080edbc2 in main (argc=1, argv=0xbfe44914) at main.cpp:665
User avatar
Bjørn
TMW Adviser
TMW Adviser
Posts: 1430
Joined: 09 Dec 2004, 19:50
Location: North Rhine-Westphalia, Germany
Contact:

Post by Bjørn » 24 Aug 2006, 23:54

You were definately missing some graphic file (since image parameter is 0x0 for drawImage). I'm assuming you're using the trunk development version. Recently the image containing all item icons got split up, and the large set of loose images is not being installed correctly yet when doing a 'make install'.

For developers this is not really a critical issue, since they don't generally install the game but run it like 'src/tmw' instead (from the tmw dir). The game will then find everything it needs directly from the "data" directory. If you had run it like that, the debugger (gdb) also would not have had a problem finding that graphics.cpp file.

There is two things we'll need to do to resolve this issue:

* Made sure a missing item icon produces a nice error message instead of a crash.
* Fix installing of the item icons
User avatar
Crush
TMW Adviser
TMW Adviser
Posts: 8046
Joined: 25 Aug 2005, 17:08
Location: Germany

Post by Crush » 25 Aug 2006, 00:12

that's odd. The drawImage function shouldn't crash when attempting to draw a "NULL image" but do nothing instead.

Code: Select all

bool Graphics::drawImage(Image *image, int srcX, int srcY, int dstX, int dstY,
        int width, int height)
{
    // Check that preconditions for blitting are met.
    if (!mScreen || !image || !image->mImage) return false;
[...]
  • former Manasource Programmer
  • former TMW Pixel artist
  • NOT a game master

Please do not send me any inquiries regarding player accounts on TMW.


You might have heard a certain rumor about me. This rumor is completely false. You might also have heard the other rumor about me. This rumor is 100% accurate.
User avatar
Bjørn
TMW Adviser
TMW Adviser
Posts: 1430
Joined: 09 Dec 2004, 19:50
Location: North Rhine-Westphalia, Germany
Contact:

Post by Bjørn » 25 Aug 2006, 00:21

Crush wrote:that's odd. The drawImage function shouldn't crash when attempting to draw a "NULL image" but do nothing instead.
There's multiple versions of drawImage. Check the line number in the crash and you can see the crash was in this one (and note mBounds accessing):

Code: Select all

bool Graphics::drawImage(Image *image, int x, int y)
{
    return drawImage(image, 0, 0, x, y, image->mBounds.w, image->mBounds.h);
}
Btw I actually think the image should not be checked for NULL since this simply hides the error, and instead the image would mysteriously fail to show up. Only valid images should be passed to drawImage.
Post Reply