1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Bug 765: use ses_load to load old tab's document

Yet another valiant wack at the beast.  This one violates abstractions
a little less deeply, so maybe it will work better.

The last attempt caused a crash when a tab was cloned after the tab's
loading had been aborted.
(cherry picked from commit 76377d9714)
This commit is contained in:
Miciah Dashiel Butler Masters 2009-05-22 23:10:54 +00:00 committed by Kalle Olavi Niemitalo
parent f5103d0cc0
commit 1eebbb9ede
3 changed files with 14 additions and 9 deletions

View File

@ -848,15 +848,16 @@ static void
setup_session(struct session *ses, struct uri *uri, struct session *base) setup_session(struct session *ses, struct uri *uri, struct session *base)
{ {
if (base && have_location(base)) { if (base && have_location(base)) {
struct location *loc = mem_calloc(1, sizeof(*loc)); ses_load(ses, get_uri_reference(cur_loc(base)->vs.uri),
NULL, NULL, CACHE_MODE_ALWAYS, TASK_FORWARD);
if (ses->doc_view && ses->doc_view->vs
&& base->doc_view && base->doc_view->vs) {
struct view_state *vs = ses->doc_view->vs;
if (loc) { destroy_vs(vs, 1);
copy_location(loc, cur_loc(base)); copy_vs(vs, base->doc_view->vs);
loc->download.data = ses;
loc->download.callback = (download_callback_T *) doc_loading_callback; ses->doc_view->vs = vs;
add_to_history(&ses->history, loc);
load_uri(loc->vs.uri, NULL, &loc->download, PRI_MAIN,
CACHE_MODE_ALWAYS, -1);
} }
} }

View File

@ -68,7 +68,7 @@ struct task {
struct session_task session_task; struct session_task session_task;
}; };
static void void
ses_load(struct session *ses, struct uri *uri, unsigned char *target_frame, ses_load(struct session *ses, struct uri *uri, unsigned char *target_frame,
struct location *target_location, enum cache_mode cache_mode, struct location *target_location, enum cache_mode cache_mode,
enum task_type task_type) enum task_type task_type)

View File

@ -19,6 +19,10 @@ struct link_def {
void abort_preloading(struct session *, int); void abort_preloading(struct session *, int);
void ses_load(struct session *ses, struct uri *uri, unsigned char *target_frame,
struct location *target_location, enum cache_mode cache_mode,
enum task_type task_type);
void ses_goto(struct session *, struct uri *, unsigned char *, void ses_goto(struct session *, struct uri *, unsigned char *,
struct location *, enum cache_mode, enum task_type, int); struct location *, enum cache_mode, enum task_type, int);
struct view_state *ses_forward(struct session *, int); struct view_state *ses_forward(struct session *, int);