From 6b9be71150478e19404a55f5c594d59ec33cd6b8 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Tue, 22 Jul 2008 12:13:27 +0300 Subject: [PATCH] 1018: Avoid assertion failure in SELECT pop-up for non-current tab Check in refresh_view() whether the tab is still current; if not, skip the draw_doc() and draw_frames() calls because draw_current_link() called within them asserts that the tab is current. However, do always call print_screen_status(), because that handles non-current tabs correctly too. I think it was not yet possible to trigger the assertion failure with setTimeout, because input.value modifications by ECMAScript do not trigger a redraw (bug 1035). --- NEWS | 4 ++++ src/viewer/text/draw.c | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index d326dcef..d7c8bff8 100644 --- a/NEWS +++ b/NEWS @@ -30,6 +30,10 @@ Bugs that should be removed from NEWS before the 0.12.0 release: * critical: Fix crash after a tab was opened during reload. This was triggered by the bug 620 fix in ELinks 0.12pre1. +* critical bug 1018: Avoid an assertion failure when selecting a value + from a pop-up menu for an input field in a tab that is no longer + current, e.g. because another tab was opened with elinks -remote. + This bug was first released in ELinks 0.12pre1. * major bug 1026 in user SMJS: Protect the callback of elinks.load_uri from the garbage collector. The elinks.load_uri method was added in ELinks 0.12pre1. diff --git a/src/viewer/text/draw.c b/src/viewer/text/draw.c index 8aa385b0..fc7cfe2b 100644 --- a/src/viewer/text/draw.c +++ b/src/viewer/text/draw.c @@ -377,7 +377,13 @@ draw_formatted(struct session *ses, int rerender) void refresh_view(struct session *ses, struct document_view *doc_view, int frames) { - draw_doc(ses, doc_view, 1); - if (frames) draw_frames(ses); + /* If refresh_view() is being called because the value of a + * form field has changed, @ses might not be in the current + * tab: consider SELECT pop-ups behind which -remote loads + * another tab, or setTimeout in ECMAScript. */ + if (ses->tab == get_current_tab(ses->tab->term)) { + draw_doc(ses, doc_view, 1); + if (frames) draw_frames(ses); + } print_screen_status(ses); } -- 2.11.4.GIT