| 33 | } |
| 34 | |
| 35 | void MapFileProgressHandler::dispatchWithLockAndCatch(const std::function<void()>& function) |
| 36 | { |
| 37 | GetUserInterfaceModule().dispatch([function, this] () |
| 38 | { |
| 39 | std::lock_guard<std::mutex> lock(_lock); |
| 40 | |
| 41 | try |
| 42 | { |
| 43 | // Any updates to the _blocker instance might throw an OperationAbortedException |
| 44 | function(); |
| 45 | } |
| 46 | catch (const wxutil::ModalProgressDialog::OperationAbortedException&) |
| 47 | { |
| 48 | // We're in the UI thread, so destroy the dialog right here |
| 49 | _blocker.reset(); |
| 50 | |
| 51 | // Remember that we got cancelled, next time a message is incoming, |
| 52 | // we will signal this to the caller |
| 53 | _wasCancelled = true; |
| 54 | } |
| 55 | }); |
| 56 | } |
| 57 | |
| 58 | void MapFileProgressHandler::handleFileOperation(map::FileOperation& msg) |
| 59 | { |