Browser window owns a few more things.

This commit is contained in:
2025-04-18 17:07:07 -04:00
parent b1854e8db8
commit dfa19f03cd
3 changed files with 9 additions and 16 deletions

View File

@ -96,7 +96,6 @@ BrowserWindow::~BrowserWindow()
dList_free(this->ImageClients);
dList_free(this->Docs);
delete this->nav_expect_url;
//for (j = 0; j < dList_length(this->PageUrls); ++j)
//delete reinterpret_cast< DilloUrl * >( dList_nth_data(this->PageUrls, j) );
//dList_free(this->PageUrls);
@ -105,8 +104,6 @@ BrowserWindow::~BrowserWindow()
dFree(dList_nth_data(this->nav_stack, j));
dList_free(this->nav_stack);
delete this->meta_refresh_url;
break;
}
}
@ -317,14 +314,12 @@ BrowserWindow *a_Bw_get(int i)
void a_Bw_expect(BrowserWindow *bw, const DilloUrl *url)
{
delete bw->nav_expect_url;
bw->nav_expect_url = a_Url_dup(url).release();
bw->nav_expect_url = a_Url_dup(url);
}
void a_Bw_cancel_expect(BrowserWindow *bw)
{
delete bw->nav_expect_url;
bw->nav_expect_url = nullptr;
bw->nav_expect_url.reset();
}
bool_t a_Bw_expecting(BrowserWindow *bw)
@ -334,6 +329,6 @@ bool_t a_Bw_expecting(BrowserWindow *bw)
const DilloUrl *a_Bw_expected_url(BrowserWindow *bw)
{
return bw->nav_expect_url;
return bw->nav_expect_url.get();
}

View File

@ -62,7 +62,7 @@ struct BrowserWindow {
/** When the user clicks a link, the URL isn't pushed directly to history;
* nav_expect_url holds it until a dw is assigned to it. Only then an entry
* is made in history and referenced at the top of nav_stack */
DilloUrl *nav_expect_url;
std::unique_ptr< DilloUrl > nav_expect_url;
/** Counter for the number of hops on a redirection. Used to stop
* redirection loops (accounts for WEB_RootUrl only) */
@ -70,7 +70,7 @@ struct BrowserWindow {
/** Url for zero-delay redirections in the META element */
int meta_refresh_status;
DilloUrl *meta_refresh_url;
std::unique_ptr< DilloUrl > meta_refresh_url;
/** HTML-bugs detected at parse time */
int num_page_bugs;

View File

@ -405,10 +405,9 @@ static void Nav_redirection0_callback(void *data)
if (bw->meta_refresh_status == 2) {
Nav_stack_move_ptr(bw, -1);
a_Nav_push(bw, bw->meta_refresh_url, referer_url);
a_Nav_push(bw, bw->meta_refresh_url.get(), referer_url);
}
delete bw->meta_refresh_url;
bw->meta_refresh_url = NULL;
bw->meta_refresh_url.reset();
bw->meta_refresh_status = 0;
a_Timeout_remove();
}
@ -421,9 +420,8 @@ void a_Nav_redirection0(BrowserWindow *bw, const DilloUrl *new_url)
dReturn_if_fail (bw != NULL);
_MSG(">>>> a_Nav_redirection0 <<<<\n");
delete bw->meta_refresh_url;
bw->meta_refresh_url = a_Url_dup(new_url).release();
a_Url_set_flags(bw->meta_refresh_url,
bw->meta_refresh_url = a_Url_dup(new_url);
a_Url_set_flags(bw->meta_refresh_url.get(),
URL_FLAGS(new_url)|URL_E2EQuery|URL_IgnoreScroll);
bw->meta_refresh_status = 2;
a_Timeout_add(0.0, Nav_redirection0_callback, (void*)bw);