aserebryakov / sdl_doom

SDL port of the linuxxdoom-1.10
10 stars 9 forks source link

Game crash on starting a new game after player death #5

Closed aserebryakov closed 11 years ago

aserebryakov commented 11 years ago

Game crashes on a new game start after the player death.

Segmentation fault in Z_FreeTags() function.

aserebryakov commented 11 years ago

There is a for-loop with the following start/end conditions:

block = mainzone->blocklist.next // start condition block != &mainzone->blocklist // end condition

It looks like the end condition is always TRUE.

Possibly the issue is caused by the incorrect allocation.

aserebryakov commented 11 years ago

The issue does not appear on the 320x200 version.

aserebryakov commented 11 years ago

The issue does not appear if game is built using 320x200 screen resolution.

That can point on the memory corruption with increased resolution.

aserebryakov commented 11 years ago

The fix provided in the commit 5eb9882a24122757d3de8e686bdf68265d242b11.

The problem was caused by the following: At ST_init() function there allocated buffer for status bar drawing with size 320x32. At function ST_refreshBackground() this buffer is written by V_DrawPatch(). As screen resolution was increased, allocated buffer was not big enough. That fact caused memory corruption.

aserebryakov commented 11 years ago

Fixed