aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2013-10-31 16:50:09 -0400
committerGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2013-10-31 16:50:09 -0400
commita7b19b251da3421060f9603133265f0a5d54492d (patch)
tree71d51aebeed93e87ed7f737a1ab3ae54437f206c /qt-ui
parent899f077abd2c582aba4e52814b858b75d0e5ea09 (diff)
downloadsubsurface-a7b19b251da3421060f9603133265f0a5d54492d.tar.gz
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>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/mainwindow.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 5a2f872b4..1dcf03314 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -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);