mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 00:11:14 +02:00
add CRCInput::getKeyNameC to fix lifetime issues
in menu.cpp, getKeyName().c_str()'s destructor was already invoked when the value was used, triggering a valgrind warning.
This commit is contained in:
@@ -1567,16 +1567,21 @@ const char * CRCInput::getSpecialKeyName(const unsigned int key)
|
||||
}
|
||||
|
||||
std::string CRCInput::getKeyName(const unsigned int key)
|
||||
{
|
||||
return (std::string)getKeyNameC(key);
|
||||
}
|
||||
|
||||
const char *CRCInput::getKeyNameC(const unsigned int key)
|
||||
{
|
||||
int lunicode_value = getUnicodeValue(key);
|
||||
if (lunicode_value == -1)
|
||||
return getSpecialKeyName(key);
|
||||
else
|
||||
{
|
||||
char tmp[2];
|
||||
static char tmp[2];
|
||||
tmp[0] = lunicode_value;
|
||||
tmp[1] = 0;
|
||||
return std::string(tmp);
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user