MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / dispatchWithLockAndCatch

Method dispatchWithLockAndCatch

radiant/ui/MapFileProgressHandler.cpp:35–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33}
34
35void 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
58void MapFileProgressHandler::handleFileOperation(map::FileOperation& msg)
59{

Callers

nothing calls this directly

Calls 3

functionClass · 0.85
dispatchMethod · 0.80
resetMethod · 0.45

Tested by

no test coverage detected