Răsfoiți Sursa

Merge pull request #781 from selfshadow/va-list-fix

Fixed reuse of va_list in traceVargs
Branimir Karadžić 9 ani în urmă
părinte
comite
8658890d37
1 a modificat fișierele cu 4 adăugiri și 1 ștergeri
  1. 4 1
      src/bgfx.cpp

+ 4 - 1
src/bgfx.cpp

@@ -65,8 +65,11 @@ namespace bgfx
 		{
 			char temp[2048];
 			char* out = temp;
+			va_list argListCopy;
+			va_copy(argListCopy, _argList);
 			int32_t len   = bx::snprintf(out, sizeof(temp), "%s (%d): ", _filePath, _line);
-			int32_t total = len + bx::vsnprintf(out + len, sizeof(temp)-len, _format, _argList);
+			int32_t total = len + bx::vsnprintf(out + len, sizeof(temp)-len, _format, argListCopy);
+			va_end(argListCopy);
 			if ( (int32_t)sizeof(temp) < total)
 			{
 				out = (char*)alloca(total+1);