mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-07 20:44:35 +00:00
[Bug #2930] Fix crash bug in LocationInformationWidget
If a user exits the LocationInformationWidget (Edit Dive Site) while a reverseGeocode lookup is in progress, the object's diveSite variable is set to null. When the reverseGeocode lookup completes, this variable is dereferenced causing an application crash. Signed-off-by: Michael Werle <micha@michaelwerle.com>
This commit is contained in:
parent
7e82205e9b
commit
37ae5a7d83
1 changed files with 5 additions and 2 deletions
|
@ -313,12 +313,15 @@ void LocationInformationWidget::on_diveSiteDistance_textChanged(const QString &s
|
||||||
|
|
||||||
void LocationInformationWidget::reverseGeocode()
|
void LocationInformationWidget::reverseGeocode()
|
||||||
{
|
{
|
||||||
|
dive_site *ds = diveSite; /* Save local copy; possibility of user closing the widget while reverseGeoLookup is running (see #2930) */
|
||||||
location_t location = parseGpsText(ui.diveSiteCoordinates->text());
|
location_t location = parseGpsText(ui.diveSiteCoordinates->text());
|
||||||
if (!diveSite || !has_location(&location))
|
if (!ds || !has_location(&location))
|
||||||
return;
|
return;
|
||||||
taxonomy_data taxonomy = { 0, 0 };
|
taxonomy_data taxonomy = { 0, 0 };
|
||||||
reverseGeoLookup(location.lat, location.lon, &taxonomy);
|
reverseGeoLookup(location.lat, location.lon, &taxonomy);
|
||||||
Command::editDiveSiteTaxonomy(diveSite, taxonomy);
|
if (ds != diveSite)
|
||||||
|
return;
|
||||||
|
Command::editDiveSiteTaxonomy(ds, taxonomy);
|
||||||
}
|
}
|
||||||
|
|
||||||
DiveLocationFilterProxyModel::DiveLocationFilterProxyModel(QObject *) : currentLocation(zero_location)
|
DiveLocationFilterProxyModel::DiveLocationFilterProxyModel(QObject *) : currentLocation(zero_location)
|
||||||
|
|
Loading…
Add table
Reference in a new issue