From 9bc9593df56c2995fec1312d57225e4c887ee5ca Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 8 Nov 2011 19:54:16 +0100 Subject: [PATCH] Fix segmentation fault when editing address not in address book (issue #615) --- src/qt/editaddressdialog.cpp | 6 ++++++ src/qt/editaddressdialog.h | 1 + src/qt/transactionview.cpp | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/src/qt/editaddressdialog.cpp b/src/qt/editaddressdialog.cpp index b8e6fe4578..457e8cf0dc 100644 --- a/src/qt/editaddressdialog.cpp +++ b/src/qt/editaddressdialog.cpp @@ -113,3 +113,9 @@ QString EditAddressDialog::getAddress() const { return address; } + +void EditAddressDialog::setAddress(const QString &address) +{ + this->address = address; + ui->addressEdit->setText(address); +} diff --git a/src/qt/editaddressdialog.h b/src/qt/editaddressdialog.h index 81086a45a8..9c9769d407 100644 --- a/src/qt/editaddressdialog.h +++ b/src/qt/editaddressdialog.h @@ -33,6 +33,7 @@ public: void accept(); QString getAddress() const; + void setAddress(const QString &address); private: bool saveCurrentRow(); diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index 92dda5784c..d39227c81f 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -322,6 +322,8 @@ void TransactionView::editLabel() // If this transaction has no associated address, exit return; } + // Is address in address book? Address book can miss address when a transaction is + // sent from outside the UI. int idx = addressBook->lookupAddress(address); if(idx != -1) { @@ -343,6 +345,8 @@ void TransactionView::editLabel() // Add sending address EditAddressDialog dlg(EditAddressDialog::NewSendingAddress, this); + dlg.setModel(addressBook); + dlg.setAddress(address); dlg.exec(); } }