TremZ/Unvanquished — Issue #18: Crash on map startup
Author: dsalt
Created: 2012-03-02 01:45:59+00:00
State: open

Backtrace:

#0 0x00007fffad8df35f in BG_InventoryContainsWeapon (weapon=1, stats=0xfc)
at src/gamelogic/gpp/src/game/bg_misc.c:3091
#1 0x00007fffad8e091f in BG_PrimaryWeapon (stats=0xfc)
at src/gamelogic/gpp/src/game/bg_misc.c:3842
#2 0x00007fffad8ff6f4 in CG_DrawPlayerClipsStack (rect=0x7fffffff4970,
backColor=0x7fffb0329184, foreColor=0x7fffffff49d0, textalign=0,
textvalign=0)
at src/gamelogic/gpp/src/cgame/cg_draw.c:3139
#3 0x00007fffad8ffa6b in CG_OwnerDraw (x=311, y=11, w=320, h=240, text_x=0,
text_y=0, ownerDraw=34, ownerDrawFlags=0, align=0, textalign=0,
textvalign=0, borderSize=1, scale=0.550000012, foreColor=0x7fffffff49d0,
backColor=0x7fffb0329184, shader=0, textStyle=0)
at src/gamelogic/gpp/src/cgame/cg_draw.c:3238
#4 0x00007fffad94214f in Item_OwnerDraw_Paint (item=0x7fffb03290f0)
at src/gamelogic/gpp/src/ui/ui_shared.c:5722
#5 0x00007fffad942900 in Item_Paint (item=0x7fffb03290f0)
at src/gamelogic/gpp/src/ui/ui_shared.c:5931
#6 0x00007fffad94365c in Menu_Paint (menu=0x7fffb7fae4b0, forcePaint=qtrue)
at src/gamelogic/gpp/src/ui/ui_shared.c:6312
#7 0x00007fffad8fafe7 in CG_DrawLoadingScreen ()
at src/gamelogic/gpp/src/cgame/cg_draw.c:1463
#8 0x00007fffad91fda0 in CG_DrawActiveFrame (serverTime=0,
stereoView=STEREO_CENTER, demoPlayback=qfalse)
at src/gamelogic/gpp/src/cgame/cg_view.c:1404
#9 0x00007fffad8d818e in vmMain (command=3, arg0=0, arg1=0, arg2=0,
arg3=-45632, arg4=-44144, arg5=4991567, arg6=-45664, arg7=4627534,
arg8=-45632, arg9=4485707, arg10=-45648, arg11=4627860)
at src/gamelogic/gpp/src/cgame/cg_main.c:67
#10 0x00000000004e43af in VM_Call (vm=0x208f1e0, callnum=3)
at src/engine/qcommon/vm.c:792
#11 0x000000000044a355 in CL_CGameRendering (stereo=STEREO_CENTER)
at src/engine/client/cl_cgame.c:1499
#12 0x0000000000469c4e in SCR_DrawScreenField (stereoFrame=STEREO_CENTER)
at src/engine/client/cl_scrn.c:644
#13 0x0000000000469d94 in SCR_UpdateScreen ()
at src/engine/client/cl_scrn.c:716
#14 0x00000000004477df in CL_CgameSystemCalls (args=0x7fffffff4f60)
at src/engine/client/cl_cgame.c:753
#15 0x00000000004e3668 in VM_DllSyscall (arg=24)
at src/engine/qcommon/vm.c:373
#16 0x00007fffad9573b4 in trap_UpdateScreen ()
at src/gamelogic/gpp/src/cgame/cg_api.c:187
#17 0x00007fffad8fafb0 in CG_UpdateMediaFraction (newFract=0.0500000007)
at src/gamelogic/gpp/src/cgame/cg_draw.c:1448
#18 0x00007fffad8dc296 in CG_Init (serverMessageNum=3,
serverCommandSequence=0, clientNum=0)
at src/gamelogic/gpp/src/cgame/cg_main.c:2103
#19 0x00007fffad8d8148 in vmMain (command=0, arg0=3, arg1=0, arg2=0, arg3=0,
arg4=-44208, arg5=28998528, arg6=29817989, arg7=4573568, arg8=-44144,
arg9=4579635, arg10=-44144, arg11=4991567)
at src/gamelogic/gpp/src/cgame/cg_main.c:52
#20 0x00000000004e43af in VM_Call (vm=0x208f1e0, callnum=0)
at src/engine/qcommon/vm.c:792
#21 0x000000000044a256 in CL_InitCGame ()
at src/engine/client/cl_cgame.c:1418
#22 0x000000000045e133 in CL_DownloadsComplete ()
at src/engine/client/cl_main.c:2807
#23 0x000000000045e582 in CL_InitDownloads ()
at src/engine/client/cl_main.c:2966
#24 0x000000000046858a in CL_ParseGamestate (msg=0x7fffffff5aa0)
at src/engine/client/cl_parse.c:752
#25 0x0000000000468d40 in CL_ParseServerMessage (msg=0x7fffffff5aa0)
at src/engine/client/cl_parse.c:1245
#26 0x000000000045febb in CL_PacketEvent (from=..., msg=0x7fffffff5aa0)
at src/engine/client/cl_main.c:3628
#27 0x00000000004bf57f in Com_EventLoop ()
at src/engine/qcommon/common.c:2766
#28 0x00000000004c08ee in Com_Frame ()
at src/engine/qcommon/common.c:3632
#29 0x0000000000477533 in main (argc=7, argv=0x7fffffffe0c8)
at src/engine/sys/sys_main.c:896

Reason: cg.snap == NULL.

Patch:

```patch
diff --git a/src/gamelogic/gpp/src/cgame/cg_draw.c b/src/gamelogic/gpp/src/cgame/cg_draw.c
index 7be5560..357f4ed 100644
--- a/src/gamelogic/gpp/src/cgame/cg_draw.c
+++ b/src/gamelogic/gpp/src/cgame/cg_draw.c
@@ -3192,130 +3192,170 @@ void CG_OwnerDraw( float x, float y, float w, float h, float text_x,
rect.w = w;
rect.h = h;

+ // cg.snap == NULL has been observed to cause segfaults
switch( ownerDraw )
{
case CG_PLAYER_CREDITS_VALUE:
- CG_DrawPlayerCreditsValue( &rect, foreColor, qtrue );
+ if (cg.snap)
+ CG_DrawPlayerCreditsValue( &rect, foreColor, qtrue );
break;
case CG_PLAYER_CREDITS_FRACTION:
- CG_DrawPlayerCreditsFraction( &rect, foreColor, shader );
+ if (cg.snap)
+ CG_DrawPlayerCreditsFraction( &rect, foreColor, shader );
break;
case CG_PLAYER_CREDITS_VALUE_NOPAD:
- CG_DrawPlayerCreditsValue( &rect, foreColor, qfalse );
+ if (cg.snap)
+ CG_DrawPlayerCreditsValue( &rect, foreColor, qfalse );
break;
case CG_PLAYER_ALIEN_EVOS:
- CG_DrawPlayerAlienEvos( &rect, text_x, text_y, foreColor, scale, textalign, textvalign, textStyle );
+ if (cg.snap)
+ CG_DrawPlayerAlienEvos( &rect, text_x, text_y, foreColor, scale, textalign, textvalign, textStyle );
break;
case CG_PLAYER_STAMINA:
- CG_DrawPlayerStaminaBar( &rect, foreColor, shader );
+ if (cg.snap)
+ CG_DrawPlayerStaminaBar( &rect, foreColor, shader );
break;
case CG_PLAYER_STAMINA_VALUE:
- CG_DrawPlayerStaminaValue( &rect, foreColor );
+ if (cg.snap)
+ CG_DrawPlayerStaminaValue( &rect, foreColor );
break;
case CG_PLAYER_STAMINA_1:
case CG_PLAYER_STAMINA_2:
case CG_PLAYER_STAMINA_3:
case CG_PLAYER_STAMINA_4:
- CG_DrawPlayerStamina( ownerDraw, &rect, backColor, foreColor, shader );
+ if (cg.snap)
+ CG_DrawPlayerStamina( ownerDraw, &rect, backColor, foreColor, shader );
break;
case CG_PLAYER_STAMINA_BOLT:
- CG_DrawPlayerStaminaBolt( &rect, backColor, foreColor, shader );
+ if (cg.snap)
+ CG_DrawPlayerStaminaBolt( &rect, backColor, foreColor, shader );
break;
case CG_PLAYER_AMMO_VALUE:
- CG_DrawPlayerAmmoValue( &rect, foreColor );
+ if (cg.snap)
+ CG_DrawPlayerAmmoValue( &rect, foreColor );
break;
case CG_PLAYER_TOTAL_AMMO_VALUE:
- CG_DrawPlayerTotalAmmoValue( &rect, foreColor );
+ if (cg.snap)
+ CG_DrawPlayerTotalAmmoValue( &rect, foreColor );
break;
case CG_PLAYER_CLIPS_VALUE:
- CG_DrawPlayerClipsValue( &rect, foreColor );
+ if (cg.snap)
+ CG_DrawPlayerClipsValue( &rect, foreColor );
break;
case CG_PLAYER_AMMO_STACK:
- CG_DrawPlayerAmmoStack( &rect, backColor, foreColor, textalign,
- textvalign );
+ if (cg.snap)
+ CG_DrawPlayerAmmoStack( &rect, backColor, foreColor, textalign,
+ textvalign );
break;
case CG_PLAYER_CLIPS_STACK:
- CG_DrawPlayerClipsStack( &rect, backColor, foreColor, textalign,
- textvalign );
+ if (cg.snap)
+ CG_DrawPlayerClipsStack( &rect, backColor, foreColor, textalign,
+ textvalign );
break;
case CG_PLAYER_BUILD_TIMER:
- CG_DrawPlayerBuildTimer( &rect, foreColor );
+ if (cg.snap)
+ CG_DrawPlayerBuildTimer( &rect, foreColor );
break;
case CG_PLAYER_HEALTH:
- CG_DrawPlayerHealthValue( &rect, foreColor );
+ if (cg.snap)
+ CG_DrawPlayerHealthValue( &rect, foreColor );
break;
case CG_PLAYER_HEALTH_CROSS:
- CG_DrawPlayerHealthCross( &rect, foreColor );
+ if (cg.snap)
+ CG_DrawPlayerHealthCross( &rect, foreColor );
break;
case CG_PLAYER_CHARGE_BAR_BG:
- CG_DrawPlayerChargeBarBG( &rect, foreColor, shader );
+ if (cg.snap)
+ CG_DrawPlayerChargeBarBG( &rect, foreColor, shader );
break;
case CG_PLAYER_CHARGE_BAR:
- CG_DrawPlayerChargeBar( &rect, foreColor, shader );
+ if (cg.snap)
+ CG_DrawPlayerChargeBar( &rect, foreColor, shader );
break;
case CG_PLAYER_CLIPS_RING:
- CG_DrawPlayerClipsRing( &rect, backColor, foreColor, shader );
+ if (cg.snap)
+ CG_DrawPlayerClipsRing( &rect, backColor, foreColor, shader );
break;
case CG_PLAYER_BUILD_TIMER_RING:
- CG_DrawPlayerBuildTimerRing( &rect, backColor, foreColor, shader );
+ if (cg.snap)
+ CG_DrawPlayerBuildTimerRing( &rect, backColor, foreColor, shader );
break;
case CG_PLAYER_WALLCLIMBING:
- CG_DrawPlayerWallclimbing( &rect, backColor, foreColor, shader );
+ if (cg.snap)
+ CG_DrawPlayerWallclimbing( &rect, backColor, foreColor, shader );
break;
case CG_PLAYER_BOOSTED:
- CG_DrawPlayerBoosted( &rect, backColor, foreColor, shader );
+ if (cg.snap)
+ CG_DrawPlayerBoosted( &rect, backColor, foreColor, shader );
break;
case CG_PLAYER_BOOST_BOLT:
- CG_DrawPlayerBoosterBolt( &rect, backColor, foreColor, shader );
+ if (cg.snap)
+ CG_DrawPlayerBoosterBolt( &rect, backColor, foreColor, shader );
break;
case CG_PLAYER_POISON_BARBS:
- CG_DrawPlayerPoisonBarbs( &rect, foreColor, shader );
+ if (cg.snap)
+ CG_DrawPlayerPoisonBarbs( &rect, foreColor, shader );
break;
case CG_PLAYER_ALIEN_SENSE:
- CG_DrawAlienSense( &rect );
+ if (cg.snap)
+ CG_DrawAlienSense( &rect );
break;
case CG_PLAYER_HUMAN_SCANNER:
- CG_DrawHumanScanner( &rect, shader, foreColor );
+ if (cg.snap)
+ CG_DrawHumanScanner( &rect, shader, foreColor );
break;
case CG_PLAYER_USABLE_BUILDABLE:
- CG_DrawUsableBuildable( &rect, shader, foreColor );
+ if (cg.snap)
+ CG_DrawUsableBuildable( &rect, shader, foreColor );
break;
case CG_KILLER:
- CG_DrawKiller( &rect, scale, foreColor, shader, textStyle );
+ if (cg.snap)
+ CG_DrawKiller( &rect, scale, foreColor, shader, textStyle );
break;
case CG_PLAYER_SELECT:
- CG_DrawItemSelect( &rect, foreColor );
+ if (cg.snap)
+ CG_DrawItemSelect( &rect, foreColor );
break;
case CG_PLAYER_WEAPONICON:
- CG_DrawWeaponIcon( &rect, foreColor );
+ if (cg.snap)
+ CG_DrawWeaponIcon( &rect, foreColor );
break;
case CG_PLAYER_SELECTTEXT:
- CG_DrawItemSelectText( &rect, scale, textStyle );
+ if (cg.snap)
+ CG_DrawItemSelectText( &rect, scale, textStyle );
break;
case CG_SPECTATORS:
- CG_DrawTeamSpectators( &rect, scale, textvalign, foreColor, shader );
+ if (cg.snap)
+ CG_DrawTeamSpectators( &rect, scale, textvalign, foreColor, shader );
break;
case CG_PLAYER_LOCATION:
- CG_DrawLocation( &rect, scale, textalign, foreColor );
+ if (cg.snap)
+ CG_DrawLocation( &rect, scale, textalign, foreColor );
break;
case CG_FOLLOW:
- CG_DrawFollow( &rect, text_x, text_y, foreColor, scale,
- textalign, textvalign, textStyle );
+ if (cg.snap)
+ CG_DrawFollow( &rect, text_x, text_y, foreColor, scale,
+ textalign, textvalign, textStyle );
break;
case CG_PLAYER_CROSSHAIRNAMES:
- CG_DrawCrosshairNames( &rect, scale, textStyle );
+ if (cg.snap)
+ CG_DrawCrosshairNames( &rect, scale, textStyle );
break;
case CG_PLAYER_CROSSHAIR:
- CG_DrawCrosshair( &rect, foreColor );
+ if (cg.snap)
+ CG_DrawCrosshair( &rect, foreColor );
break;
case CG_STAGE_REPORT_TEXT:
- CG_DrawStageReport( &rect, text_x, text_y, foreColor, scale, textalign, textvalign, textStyle );
+ if (cg.snap)
+ CG_DrawStageReport( &rect, text_x, text_y, foreColor, scale, textalign, textvalign, textStyle );
break;
case CG_ALIENS_SCORE_LABEL:
- CG_DrawTeamLabel( &rect, TEAM_ALIENS, text_x, text_y, foreColor, scale, textalign, textvalign, textStyle );
+ if (cg.snap)
+ CG_DrawTeamLabel( &rect, TEAM_ALIENS, text_x, text_y, foreColor, scale, textalign, textvalign, textStyle );
break;
case CG_HUMANS_SCORE_LABEL:
- CG_DrawTeamLabel( &rect, TEAM_HUMANS, text_x, text_y, foreColor, scale, textalign, textvalign, textStyle );
+ if (cg.snap)
+ CG_DrawTeamLabel( &rect, TEAM_HUMANS, text_x, text_y, foreColor, scale, textalign, textvalign, textStyle );
break;

//loading screen
```

(There's probably a better fix.)