cgeo/c-geo-opensource — Issue #670: FC in Progress.dismiss
Author: samueltardieu
Created: 2011-10-16 07:52:12+00:00
State: open

```
10-16 08:41:57.494 E/AndroidRuntime(5139): at cgeo.geocaching.activity.Progress.dismiss(Progress.java:15)
10-16 08:41:57.494 E/AndroidRuntime(5139): at cgeo.geocaching.cgeodetail.setView(cgeodetail.java:1085)
10-16 08:41:57.494 E/AndroidRuntime(5139): at cgeo.geocaching.cgeodetail.access$400(cgeodetail.java:74)
10-16 08:41:57.494 E/AndroidRuntime(5139): at cgeo.geocaching.cgeodetail$4.handleMessage(cgeodetail.java:188)
10-16 08:41:57.599 W/ActivityManager(190): Force finishing activity cgeo.geocaching/.cgeodetail
```

I think there are several things to fix in `Progress`:

- methods should be made `synchronized` because when using background tasks several things can happen simultaneously if the user goes back and reenters a cache details activity for example
- `Progress.show` should take a handler rather than a boolean `cancelable` to install the proper handler in this case (which will ultimately dismiss the dialog before letting another activity / background task use it)
- in `Progress.dismiss`, `dialog` should be set to `null` in any case

A better fix would probably not to have a static `Progress` but to have a `Progress` instance as a field in `cgeodetail`.