From 8e9290c517ce09ab83cf786a5ba424fc9e5c3f52 Mon Sep 17 00:00:00 2001 From: Jorge Arellano Cid Date: Wed, 12 Aug 2009 21:25:19 -0400 Subject: Bugfix: remove the empty cache entry lingering after connection abort --- ChangeLog | 1 + src/capi.c | 24 ++++++++++++++++++++++-- src/nav.c | 9 +++++++++ src/nav.h | 1 + 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 62aa345c..5990b746 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,7 @@ dillo-2.2 [??] is simpler and helps to avoid race conditions. - Updated CCCwork.txt to the new scheme. - Fixed a bug with OPTION element (it was parsing entities twice). + - Bugfix: remove the empty cache entry lingering after connection abort. Patches: Jorge Arellano Cid +- Fix segfault from AREA when MAP is missing name attribute. - Fix image map coordinates when margin/border/padding present. diff --git a/src/capi.c b/src/capi.c index 5da85fce..5e5eadb2 100644 --- a/src/capi.c +++ b/src/capi.c @@ -102,6 +102,21 @@ static capi_conn_t * return conn; } +/* + * Validate a capi_conn_t pointer. + * Return value: NULL if not valid, conn otherwise. + */ +static capi_conn_t *Capi_conn_valid(capi_conn_t *conn) +{ + int i; + + for (i = 0; i < DpiConnSize; ++i) + if (conn == DpiConn[i]) + return conn; + + return NULL; +} + /* * Increment the reference count and add to the list if not present */ @@ -310,9 +325,9 @@ static char *Capi_dpi_build_cmd(DilloWeb *web, char *server) */ int a_Capi_open_url(DilloWeb *web, CA_Callback_t Call, void *CbData) { - capi_conn_t *conn; int reload; char *cmd, *server; + capi_conn_t *conn = NULL; const char *scheme = URL_SCHEME(web->url); int safe = 0, ret = 0, use_cache = 0; @@ -380,7 +395,10 @@ int a_Capi_open_url(DilloWeb *web, CA_Callback_t Call, void *CbData) } if (use_cache) { - ret = a_Cache_open_url(web, Call, CbData); + if (!conn || (conn && Capi_conn_valid(conn))) { + /* not aborted, let's continue... */ + ret = a_Cache_open_url(web, Call, CbData); + } } else { a_Web_free(web); } @@ -593,6 +611,8 @@ void a_Capi_ccc(int Op, int Branch, int Dir, ChainLink *Info, a_Capi_ccc(OpAbort, 2, BCK, conn->InfoRecv, NULL, NULL); } } + /* if URL == expect-url */ + a_Nav_cancel_expect_if_eq(conn->bw, conn->url); /* finish conn */ Capi_conn_unref(conn); dFree(Info); diff --git a/src/nav.c b/src/nav.c index 1be1ba98..441d5997 100644 --- a/src/nav.c +++ b/src/nav.c @@ -257,6 +257,15 @@ void a_Nav_cancel_expect(BrowserWindow *bw) --bw->meta_refresh_status; } +/* + * Cancel the expect if 'url' matches. + */ +void a_Nav_cancel_expect_if_eq(BrowserWindow *bw, const DilloUrl *url) +{ + if (bw->nav_expecting && a_Url_cmp(url, bw->nav_expect_url) == 0) + a_Nav_cancel_expect(bw); +} + /* * We have an answer! Set things accordingly. * This function is called for root URLs only. diff --git a/src/nav.h b/src/nav.h index a37d012c..65c603b5 100644 --- a/src/nav.h +++ b/src/nav.h @@ -25,6 +25,7 @@ void a_Nav_reload(BrowserWindow *bw); void a_Nav_jump(BrowserWindow *bw, int offset, int new_bw); void a_Nav_free(BrowserWindow *bw); void a_Nav_cancel_expect (BrowserWindow *bw); +void a_Nav_cancel_expect_if_eq(BrowserWindow *bw, const DilloUrl *url); void a_Nav_expect_done(BrowserWindow *bw); int a_Nav_stack_ptr(BrowserWindow *bw); int a_Nav_stack_size(BrowserWindow *bw); -- cgit v1.2.3