summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-03-16 10:50:25 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-03-16 10:51:41 -0700
commit84aab5ffedc6f9c1eebace215b5614a118a9280b (patch)
treed4ad2639aea43704e9950384ddc547e6736155f4 /qt-ui
parent0d77b921eb11a2a013555078569c766e4d36a84f (diff)
downloadsubsurface-84aab5ffedc6f9c1eebace215b5614a118a9280b.tar.gz
Correctly create a dive site with the name entered on the Notes tab
The char pointer was out of scope by the time we created the dive site. Also remove the misleading comment above - it really makes sense to do nothing in that function. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/maintab.cpp15
1 files changed, 2 insertions, 13 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 7958ad3d8..abf1382ad 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -1114,18 +1114,6 @@ void MainTab::on_location_textChanged(const QString &text)
if (currentTrip) {
free(displayedTrip.location);
displayedTrip.location = strdup(ui.location->text().toUtf8().data());
- } else {
- // this means we switched dive sites... this requires a lot more thinking
- //
- //
- // FIXME
- //
- // TODO
- //
- //
- //
- // free(displayed_dive.location);
- // displayed_dive.location = strdup(ui.location->text().toUtf8().data());
}
markChangedWidget(ui.location);
}
@@ -1134,11 +1122,12 @@ void MainTab::on_location_textChanged(const QString &text)
void MainTab::on_location_editingFinished()
{
// find the dive site or create it
- const char *name = ui.location->text().toUtf8().data();
+ const char *name = copy_string(qPrintable(ui.location->text()));
uint32_t uuid = get_dive_site_uuid_by_name(name, NULL);
if (!uuid)
uuid = create_dive_site(name);
displayed_dive.dive_site_uuid = uuid;
+ free((void*)name);
}
void MainTab::on_suit_textChanged(const QString &text)