diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-23 23:22:30 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-23 23:22:30 +0300 |
commit | 480f3b7e9526d2219267d5426a7c997574846d59 (patch) | |
tree | b9c788eee01d353df9c6c68705cf3e2e31e5b2d5 | |
parent | 5ee5be62e103ae2bb18df2ba1bf64d2c90ba0387 (diff) |
DocumentWidget: Crash after receiving a redirect
The `GmRequest` object is destroyed after handling a redirect, but afterwards a check was still made to cache the request contents.
IssueID #148
-rw-r--r-- | src/ui/documentwidget.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 6cf06f1e..f15d4e3b 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -2033,7 +2033,7 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) | |||
2033 | return iFalse; | 2033 | return iFalse; |
2034 | } | 2034 | } |
2035 | else if (equalWidget_Command(cmd, w, "document.request.finished") && | 2035 | else if (equalWidget_Command(cmd, w, "document.request.finished") && |
2036 | pointerLabel_Command(cmd, "request") == d->request) { | 2036 | d->request && pointerLabel_Command(cmd, "request") == d->request) { |
2037 | set_Block(&d->sourceContent, body_GmRequest(d->request)); | 2037 | set_Block(&d->sourceContent, body_GmRequest(d->request)); |
2038 | if (!isSuccess_GmStatusCode(status_GmRequest(d->request))) { | 2038 | if (!isSuccess_GmStatusCode(status_GmRequest(d->request))) { |
2039 | format_String(&d->sourceHeader, | 2039 | format_String(&d->sourceHeader, |
@@ -2048,7 +2048,8 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) | |||
2048 | checkResponse_DocumentWidget_(d); | 2048 | checkResponse_DocumentWidget_(d); |
2049 | init_Anim(&d->scrollY.pos, d->initNormScrollY * size_GmDocument(d->doc).y); /* TODO: unless user already scrolled! */ | 2049 | init_Anim(&d->scrollY.pos, d->initNormScrollY * size_GmDocument(d->doc).y); /* TODO: unless user already scrolled! */ |
2050 | d->state = ready_RequestState; | 2050 | d->state = ready_RequestState; |
2051 | /* The response may be cached. */ { | 2051 | /* The response may be cached. */ |
2052 | if (d->request) { | ||
2052 | if (!equal_Rangecc(urlScheme_String(d->mod.url), "about") && | 2053 | if (!equal_Rangecc(urlScheme_String(d->mod.url), "about") && |
2053 | startsWithCase_String(meta_GmRequest(d->request), "text/")) { | 2054 | startsWithCase_String(meta_GmRequest(d->request), "text/")) { |
2054 | setCachedResponse_History(d->mod.history, lockResponse_GmRequest(d->request)); | 2055 | setCachedResponse_History(d->mod.history, lockResponse_GmRequest(d->request)); |