Fix mutex double-lock
This commit is contained in:
@@ -332,8 +332,8 @@ HRESULT CSiaDriveDlg::OnButtonUnlockWallet(IHTMLElement* /*pElement*/)
|
||||
QueueUiAction([this]() {
|
||||
SetWalletUnlockPassword(L"");
|
||||
AfxMessageBox(L"Invalid password entered");
|
||||
SetFocusToElement(L"ID_WalletUnlockPwd");
|
||||
SetBodyEnabled(true);
|
||||
SetFocusToElement(L"ID_WalletUnlockPwd");
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -473,11 +473,17 @@ void CSiaDriveDlg::QueueUiAction(std::function<void()> fn)
|
||||
|
||||
void CSiaDriveDlg::ProcessUiActionQueue()
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_uiActionQueueMutex);
|
||||
while (_uiActionQueue.size())
|
||||
std::deque<std::function<void()>> items;
|
||||
{
|
||||
_uiActionQueue.front()();
|
||||
_uiActionQueue.pop_front();
|
||||
std::lock_guard<std::mutex> l(_uiActionQueueMutex);
|
||||
items = _uiActionQueue;
|
||||
_uiActionQueue.clear();
|
||||
}
|
||||
|
||||
while (items.size())
|
||||
{
|
||||
items.front()();
|
||||
items.pop_front();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user