Remove last dlist from browser window.

This commit is contained in:
2026-01-08 07:25:41 -05:00
parent 24d68c53e3
commit a93ed33c22
3 changed files with 15 additions and 21 deletions
+13 -19
View File
@@ -64,7 +64,6 @@ BrowserWindow *a_Bw_new(void)
bw->meta_refresh_status = 0;
bw->meta_refresh_url = NULL;
bw->ImageClients = dList_new(8);
bw->NumImages = 0;
bw->NumImagesGot = 0;
bw->NumPendingStyleSheets = 0;
@@ -90,9 +89,6 @@ BrowserWindow::~BrowserWindow()
if (bws[i] == this) {
a_List_remove(bws, i, num_bws);
dList_free(this->ImageClients);
break;
}
}
@@ -114,12 +110,12 @@ void a_Bw_add_client(BrowserWindow *bw, int Key, int Root)
if (Root) {
bw->RootClients.push_back(Key);
} else {
dList_append(bw->ImageClients, INT2VOIDP(Key));
bw->ImageClients.push_back( Key);
bw->NumImages++;
/* --Images progress-bar stuff-- */
a_UIcmd_set_img_prog(bw, bw->NumImagesGot, bw->NumImages, 1);
}
if (bw->RootClients.size() + dList_length(bw->ImageClients) == 1)
if (bw->RootClients.size() + bw->ImageClients.size() == 1)
a_UIcmd_set_buttons_sens(bw);
}
@@ -130,17 +126,18 @@ void a_Bw_add_client(BrowserWindow *bw, int Key, int Root)
*/
int a_Bw_remove_client(BrowserWindow *bw, int ClientKey)
{
void *data;
bool found= false;
auto where= std::find( begin( bw->RootClients ), end( bw->RootClients ), ClientKey );
if (where != end( bw->RootClients )) {
bw->RootClients.erase( where );
} else if ((data = dList_find(bw->ImageClients, INT2VOIDP(ClientKey)))) {
dList_remove_fast(bw->ImageClients, data);
} else if (auto data = std::find( begin( bw->ImageClients ), end( bw->ImageClients ), ClientKey ); data != end( bw->ImageClients ) ) {
found= *data;
bw->ImageClients.erase( data );
++bw->NumImagesGot;
}
return data ? 0 : 1;
return not found;
}
/**
@@ -165,7 +162,6 @@ void a_Bw_close_client(BrowserWindow *bw, int ClientKey)
*/
void a_Bw_stop_clients(BrowserWindow *bw, int flags)
{
void *data;
int which;
if (flags & BW_Root) {
@@ -178,10 +174,11 @@ void a_Bw_stop_clients(BrowserWindow *bw, int flags)
if (flags & BW_Img) {
/* Remove image clients */
while ((data = dList_nth_data(bw->ImageClients, 0))) {
a_Capi_stop_client(VOIDP2INT(data), (flags & BW_Force));
dList_remove_fast(bw->ImageClients, data);
for( const auto &data: bw->ImageClients )
{
a_Capi_stop_client(data, (flags & BW_Force));
}
bw->ImageClients.clear();
}
}
@@ -264,15 +261,12 @@ void a_Bw_remove_doc(BrowserWindow *bw, DilloHtml *vdoc)
*/
void a_Bw_cleanup(BrowserWindow *bw)
{
void *data;
/* Remove root clients */
bw->RootClients.clear();
/* Remove image clients */
while ((data = dList_nth_data(bw->ImageClients, 0))) {
dList_remove_fast(bw->ImageClients, data);
}
bw->ImageClients.clear();
/* Remove PageUrls */
bw->PageUrls.clear();
+1 -1
View File
@@ -57,7 +57,7 @@ struct BrowserWindow {
/** A list of active cache clients in the window (The primary Key) */
std::vector< int > RootClients;
/** Image Keys for all active connections in the window */
Dlist *ImageClients;
std::vector< int > ImageClients;
/** Number of images in the page */
int NumImages;
/** Number of images already loaded */
+1 -1
View File
@@ -1559,7 +1559,7 @@ void a_UIcmd::a_UIcmd_set_buttons_sens(BrowserWindow *bw)
int sens;
// Stop
sens = (dList_length(bw->ImageClients) || bw->RootClients.size());
sens = (bw->ImageClients.size() || bw->RootClients.size());
BW2UI(bw)->button_set_sens(UI_STOP, sens);
// Back
sens = (a_Nav_stack_ptr(bw) > 0);