View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0008878||Multi Theft Auto : San Andreas||Client||public||2015-06-08 19:42||2015-06-27 03:52|
|Target Version||1.5||Fixed in Version||1.5|
|Summary||0008878: [1.5] Client-side getElementID returns garbage|
After I updated client to version 1.5, getElementID() returns strange characters, like "ċ쐣j"
|Steps To Reproduce|
|Tags||No tags attached.|
this bug also occurs in map editor
Confirmed in v1.5-release-7307
Quicker way to test:
local mkr = createMarker(0, 0, 0, "cylinder")
Edit: It seems that if you aim at something in map editor, the value being returned each frame is different, something got seriously messed up and it's breaking stuff like you can't select things from the element list.
Nasty bug. We relied on undefined behaviour there which worked in VS2008, but does no longer work under VS2013.
This calls CClientEntity::GetName, which returns a copy of the SString CClientEntity::m_strName. Afterwards SString::operator const char* is invoked, returning a pointer to a char array containing our id.+
However since our return value of CClientEntity::GetName is not stored anywhere it now gets deleted and the SString's memory area is free for reuse per the standard. This also invalidates our char pointer to the name which was incorrectly reused.
Also changed CClientEntity::GetName to have a return type of const SString& and be const itself to avoid more issues of this kind with CClientEntity::GetName.