fix(request): clear the stale payment URI, show it only for an address

The request-payment dialog kept its generated payment URI across opens
and closes. A dialog opened for an address with no payable shielded
address could still show the previous request's URI, and the string
lingered after the dialog closed.

- The payment URI is cleared when the dialog opens, when it closes, and
  on the close cleanup path.
- The URI field is shown only when there is both a URI and a real
  address to pay.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-10-13 16:00:10 -05:00
co-authored by Claude Opus 4.8
parent 76daf9619d
commit b4ff9a10a2
+6 -1
View File
@@ -46,6 +46,7 @@ void RequestPaymentDialog::show(const std::string& address)
s_amount = 0.0;
s_memo[0] = '\0';
s_label[0] = '\0';
s_payment_uri.clear();
s_uri_dirty = true;
// Only a shielded address can be paid (DragonX is a private chain): never prefill a mining address.
@@ -66,6 +67,7 @@ void RequestPaymentDialog::show(const std::string& address)
void RequestPaymentDialog::hide()
{
s_open = false;
s_payment_uri.clear();
if (s_qr_texture != 0) {
FreeQRTexture(s_qr_texture);
s_qr_texture = 0;
@@ -184,7 +186,7 @@ void RequestPaymentDialog::render(App* app)
ImGui::Spacing();
// Payment URI display
if (!s_payment_uri.empty()) {
if (!s_payment_uri.empty() && s_address[0] != '\0') {
ImGui::Text("%s", TR("request_payment_uri"));
// Bordered read-only field: bounds the raw drgx: URI within a box (it horizontal-scrolls if
// long) rather than 4-char-chunking it like an address or letting a plain field overflow.
@@ -249,6 +251,9 @@ void RequestPaymentDialog::render(App* app)
}
// Cleanup on close
if (!s_open) {
s_payment_uri.clear();
}
if (!s_open && s_qr_texture != 0) {
FreeQRTexture(s_qr_texture);
s_qr_texture = 0;