mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Fix leak, enable NRVO in Core::getUsername
This commit is contained in:
parent
edca806af1
commit
3047a65120
|
@ -959,13 +959,13 @@ void Core::removeGroup(int groupId)
|
|||
|
||||
QString Core::getUsername()
|
||||
{
|
||||
QString sname;
|
||||
int size = tox_get_self_name_size(tox);
|
||||
uint8_t* name = new uint8_t[size];
|
||||
if (tox_get_self_name(tox, name) == size)
|
||||
return QString(CString::toString(name, size));
|
||||
else
|
||||
return QString();
|
||||
sname = CString::toString(name, size);
|
||||
delete[] name;
|
||||
return sname;
|
||||
}
|
||||
|
||||
void Core::setUsername(const QString& username)
|
||||
|
|
Loading…
Reference in New Issue
Block a user