mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Removed Reference to dangling pointer.
We cannot use tr("").toLocal8bit().constData(); on a function that expects a char* because the object will be deleted on the next line, so a strdup is necessary. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
This commit is contained in:
parent
899f077abd
commit
a7b19b251d
1 changed files with 2 additions and 1 deletions
|
@ -280,7 +280,8 @@ void MainWindow::on_actionAddDive_triggered()
|
|||
// now cheat - create one dive that we use to store the info tab data in
|
||||
struct dive *dive = alloc_dive();
|
||||
dive->when = QDateTime::currentMSecsSinceEpoch() / 1000L;
|
||||
dive->dc.model = tr("manually added dive").toLocal8Bit().constData(); // do not use tr here since it expects a char*.
|
||||
const char* model = strdup(tr("manulaly added dive").toLocal8Bit().constData());
|
||||
dive->dc.model = model; // do not use tr here since it expects a char*.
|
||||
record_dive(dive);
|
||||
select_dive(get_divenr(dive));
|
||||
ui.InfoWidget->updateDiveInfo(selected_dive);
|
||||
|
|
Loading…
Reference in a new issue