From 4bd217299a9a7977d151431e15479fe16b7fbb30 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Tue, 17 Mar 2020 21:26:57 +0100 Subject: mobile/edit: don't add dive site twice to table When editing a dive on mobile we might have to create a new dive site. That site is added to the global dive site table in the undo command. However, the code in QMLManager created the dive site with create_dive_site*() functions, which already adds it to the table. The undo command then added the dive site again leading to a hang of the application. To solve this problem, create new alloc_dive_site*() functions that do the same as create_dive_site*() but do not add it to the table. Signed-off-by: Berthold Stoeger --- mobile-widgets/qmlmanager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mobile-widgets/qmlmanager.cpp') diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 939ec51bf..dd0a37282 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -922,7 +922,7 @@ static void setupDivesite(DiveSiteChange &res, struct dive *d, struct dive_site res.editDs = ds; res.location = location; } else { - res.createdDs.reset(create_dive_site_with_gps(locationtext, &location, &dive_site_table)); + res.createdDs.reset(alloc_dive_site_with_name(locationtext)); add_dive_to_dive_site(d, res.createdDs.get()); } res.changed = true; @@ -1040,7 +1040,7 @@ bool QMLManager::checkLocation(DiveSiteChange &res, const DiveObjectHelper &myDi if (myDive.location != location) { ds = get_dive_site_by_name(qPrintable(location), &dive_site_table); if (!ds && !location.isEmpty()) { - res.createdDs.reset(create_dive_site(qPrintable(location), &dive_site_table)); + res.createdDs.reset(alloc_dive_site_with_name(qPrintable(location))); res.changed = true; ds = res.createdDs.get(); } -- cgit v1.2.3-70-g09d2