1
0
Fork 0

HUD::Ladder::draw was capturing the value of a freed temporary

Fix from Csaba Halász
This commit is contained in:
Tim Moore 2009-01-14 11:22:18 +01:00
parent 736823d032
commit c3d611f7f9

View file

@ -540,7 +540,9 @@ void HUD::Ladder::draw(void)
// draw numbers
std::ostringstream str;
str << i;
const char *num = str.str().c_str();
// must keep this string, otherwise it will free the c_str!
string num_str = str.str();
const char *num = num_str.c_str();
int valign = numoffs.y > 0 ? BOTTOM : numoffs.y < 0 ? TOP : VCENTER;
draw_text(lo.x - numoffs.x, lo.y + numoffs.y, num,
valign | (numoffs.x == 0 ? CENTER : numoffs.x > 0 ? RIGHT : LEFT));