Bug 794 - tab-close-all-but-current crashes
Kalle Olavi Niemitalo <[email protected]>
| Newsgroups | gmane.comp.web.links |
|---|---|
| Message-ID | <[email protected]> |
I was going to add the following as a comment to bug 794, but
Bugzilla doesn't understand I have logged in, so I'll post it
here instead. (Bugzilla properly checks the e-mail address and
password and gives me cookies, but then seems to ignore them.)
------------------------------------------------------------
I like the second patch more than the first one.
These functions have delete_window calls that can close tabs:
- src/terminal/tab.c (really_close_tab)
- src/terminal/tab.c (really_close_tabs): fixed by your patches
in this bug
- src/terminal/terminal.c (destroy_terminal): already fixed
really_close_tab appears to leave an out-of-range value in
term->current_tab if the current tab is the rightmost one and
some other tab is being deleted. I can reproduce this crash:
1. Run elinks -session-ring 2
2. Set ui.tabs.confirm_close = 1
3. Press t to open another tab.
4. Press c to pop up the "Close tab" dialog; keep it open.
5. Run elinks -session-ring 2 -remote http://elinks.cz/
This opens and selects a new tab, which becomes the rightmost
of three tabs.
6. Answer "Yes" to the "Close tab" dialog.
This closes the second tab and causes an assertion to fail:
tab number out of range.
These crashes can of course be plugged one by one, but I think a
general solution would be more appropriate. Some possibilities:
(a) Make delete_window update terminal.current_tab, presumably
as part of EVENT_ABORT processing. This update requires
O(num_tabs) time, but delete_window already costs that
because it calls redraw_terminal. When the last tab is
deleted, delete_window could write e.g. -1 to
terminal.current_tab; but get_current_tab need not be
callable in that situation.
(b) Make terminal.current_tab a pointer so that it need not
be changed if other tabs are deleted.
(c) Make get_current_tab return NULL without crashing if the
number is out of range; make callers cope with that.
_______________________________________________
elinks-dev mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/elinks-dev
signature.asc
(application/pgp-signature, 188 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQFE3XrUHm9IGt60eMgRAkFbAKDjHqCbn0H/xqXDGBy40OHvtSaAugCgskmw KTXhMEfkODicnkeiFAl1iPc= =+0a9 -----END PGP SIGNATURE-----