Summary | RosterManager::synchronize() is not thread safe! |
Queue | gloox |
Queue Version | 1.0.13 |
Type | Bug |
State | Unconfirmed |
Priority | 3. High |
Owners | |
Requester | matias.snellingen (at) outlook (dot) com |
Created | 08/17/2015 (3036 days ago) |
Due | |
Updated | 08/17/2015 (3036 days ago) |
Assigned | |
Resolved |
State ⇒ Unconfirmed
Priority ⇒ 3. High
Type ⇒ Bug
Summary ⇒ RosterManager::synchronize() is not thread safe!
Queue ⇒ gloox
// remove first roster item
auto first_item_jid = jabber.rosterManager()->roster()->begin()->first;
jabber.rosterManager()->remove(first_item_jid);
jabber.rosterManager()->synchronize();
// this code will crash since iterators are invalidated by
gloox::Client::connect thread
for (auto roster_item : *jabber.rosterManager()->roster())
{
// simulate spending some time on each roster item
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
The for each loop will crash even if it does not do any write operation.
And based on https://camaya.net/gloox/faq/#threadsafety, it should not?