aboutsummaryrefslogtreecommitdiff
path: root/src/ui.cpp
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2011-07-02 16:46:07 -0400
committerJeff Garzik <jgarzik@pobox.com>2011-07-02 16:46:07 -0400
commita76899624ab4987dab7ca81d5ed22af140482d42 (patch)
tree6a36c5573151f4a6e5bba7c39e4e05380ded8a02 /src/ui.cpp
parent1a19fc17b27e72991265a7a28c4f818d36820e43 (diff)
parent4d410cfce967a42cca7db13288b72baec29423d1 (diff)
Merge branch 'tmp2' into tmp3
Diffstat (limited to 'src/ui.cpp')
-rw-r--r--src/ui.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/ui.cpp b/src/ui.cpp
index a49741f54f..2cbcfd5bd8 100644
--- a/src/ui.cpp
+++ b/src/ui.cpp
@@ -1186,7 +1186,8 @@ void CMainFrame::OnButtonNew(wxCommandEvent& event)
string strAddress = PubKeyToAddress(pwalletMain->GetKeyFromKeyPool());
// Save
- pwalletMain->SetAddressBookName(strAddress, strName);
+ CRITICAL_BLOCK(pwalletMain->cs_mapAddressBook)
+ pwalletMain->SetAddressBookName(strAddress, strName);
SetDefaultReceivingAddress(strAddress);
}
@@ -2444,7 +2445,8 @@ void CAddressBookDialog::OnListEndLabelEdit(wxListEvent& event)
if (event.IsEditCancelled())
return;
string strAddress = (string)GetItemText(m_listCtrl, event.GetIndex(), 1);
- pwalletMain->SetAddressBookName(strAddress, string(event.GetText()));
+ CRITICAL_BLOCK(pwalletMain->cs_mapAddressBook)
+ pwalletMain->SetAddressBookName(strAddress, string(event.GetText()));
pframeMain->RefreshListCtrl();
}
@@ -2479,7 +2481,8 @@ void CAddressBookDialog::OnButtonDelete(wxCommandEvent& event)
if (m_listCtrl->GetItemState(nIndex, wxLIST_STATE_SELECTED))
{
string strAddress = (string)GetItemText(m_listCtrl, nIndex, 1);
- CWalletDB(pwalletMain->strWalletFile).EraseName(strAddress);
+ CRITICAL_BLOCK(pwalletMain->cs_mapAddressBook)
+ pwalletMain->DelAddressBookName(strAddress);
m_listCtrl->DeleteItem(nIndex);
}
}
@@ -2538,9 +2541,12 @@ void CAddressBookDialog::OnButtonEdit(wxCommandEvent& event)
}
// Write back
- if (strAddress != strAddressOrg)
- CWalletDB(pwalletMain->strWalletFile).EraseName(strAddressOrg);
- pwalletMain->SetAddressBookName(strAddress, strName);
+ CRITICAL_BLOCK(pwalletMain->cs_mapAddressBook)
+ {
+ if (strAddress != strAddressOrg)
+ pwalletMain->DelAddressBookName(strAddressOrg);
+ pwalletMain->SetAddressBookName(strAddress, strName);
+ }
m_listCtrl->SetItem(nIndex, 1, strAddress);
m_listCtrl->SetItemText(nIndex, strName);
pframeMain->RefreshListCtrl();
@@ -2580,7 +2586,8 @@ void CAddressBookDialog::OnButtonNew(wxCommandEvent& event)
}
// Add to list and select it
- pwalletMain->SetAddressBookName(strAddress, strName);
+ CRITICAL_BLOCK(pwalletMain->cs_mapAddressBook)
+ pwalletMain->SetAddressBookName(strAddress, strName);
int nIndex = InsertLine(m_listCtrl, strName, strAddress);
SetSelection(m_listCtrl, nIndex);
m_listCtrl->SetFocus();