From 9e1e94bee0da92a9b753e211f798b22e93713e95 Mon Sep 17 00:00:00 2001 From: Miciah Dashiel Butler Masters Date: Tue, 10 Jun 2008 06:41:34 +0000 Subject: [PATCH] Bug 620: Reset form fields to default values on reload Do not retain changed values in form fields when the user reloads. Doing so can be confusing or even cause data-loss when new default values are specified in the updated document. For example, when editing an article on Wikipedia, one loads the edit page for the article, makes and submits changes, goes back to the edit page to make further modifications, and reloads to get the new article text. Before this change, reloading the edit page would not update the textarea on the page with the new article source, which can lead one (and has led me) to make changes to the original version of the article by accident. This fixes bug 620. --- src/document/renderer.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/document/renderer.c b/src/document/renderer.c index 509f3c25a..ecc240afa 100644 --- a/src/document/renderer.c +++ b/src/document/renderer.c @@ -36,6 +36,7 @@ #include "util/error.h" #include "util/memory.h" #include "util/string.h" +#include "viewer/text/form.h" #include "viewer/text/view.h" #include "viewer/text/vs.h" @@ -335,6 +336,11 @@ render_document(struct view_state *vs, struct document_view *doc_view, if (!document) return; doc_view->document = document; + if (doc_view->session + && doc_view->session->reloadlevel > CACHE_MODE_NORMAL) + while (vs->form_info_len) + mem_free_if(vs->form_info[--vs->form_info_len].value); + shrink_memory(0); render_encoded_document(cached, document);