File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed
src/framework/global/thirdparty/kors_async/async/internal Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -36,18 +36,13 @@ AsyncImpl* AsyncImpl::instance()
3636void AsyncImpl::disconnectAsync (Asyncable* caller)
3737{
3838 std::lock_guard locker (m_mutex);
39- uint64_t key = 0 ;
40- std::map<uint64_t , Call>::const_iterator it = m_calls.cbegin (), end = m_calls.cend ();
41- for (; it != end; ++it) {
39+
40+ for (auto it = m_calls.cbegin (), end = m_calls.cend (); it != end; ++it) {
4241 if (it->second .caller == caller) {
43- key = it-> first ;
42+ m_calls. erase (it) ;
4443 break ;
4544 }
4645 }
47-
48- if (key) {
49- m_calls.erase (key);
50- }
5146}
5247
5348void AsyncImpl::call (Asyncable* caller, IFunction* f, const std::thread::id& th)
@@ -79,14 +74,15 @@ void AsyncImpl::onCall(uint64_t key)
7974 }
8075
8176 c = it->second ;
77+
8278 m_calls.erase (it);
79+
80+ if (c.caller ) {
81+ c.caller ->disconnectAsync (this );
82+ }
8383 }
8484
8585 c.f ->call ();
8686
87- if (c.caller ) {
88- c.caller ->disconnectAsync (this );
89- }
90-
9187 delete c.f ;
9288}
You can’t perform that action at this time.
0 commit comments