mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fix another dangling pointer
Same problem as the previous commit: toStdString() returns a temporary, and c_str() will return a pointer to internal data, freed at the end of the statement. So get the pointer to be strcpy'ed in the same statement. Changed to toUtf8() to be more explicit about the encoding and to avoid std::string Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
497d6e3e6c
commit
2e0a51264f
1 changed files with 2 additions and 4 deletions
|
@ -841,10 +841,8 @@ void ProfileWidget2::editName()
|
|||
lengthWarning.exec();
|
||||
return;
|
||||
}
|
||||
const char *temp;
|
||||
temp = newName.toStdString().c_str();
|
||||
strcpy(event->name, temp);
|
||||
remember_event(temp);
|
||||
strcpy(event->name, newName.toUtf8());
|
||||
remember_event(event->name);
|
||||
}
|
||||
replot();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue