diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-03-16 10:50:25 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-03-16 10:51:41 -0700 |
commit | 84aab5ffedc6f9c1eebace215b5614a118a9280b (patch) | |
tree | d4ad2639aea43704e9950384ddc547e6736155f4 | |
parent | 0d77b921eb11a2a013555078569c766e4d36a84f (diff) | |
download | subsurface-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>
-rw-r--r-- | qt-ui/maintab.cpp | 15 |
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) |