mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-03 09:44:24 +03:00
Ensure we correctly release all icon resources associated with trees, SSL certs, search providers, etc.
svn path=/trunk/netsurf/; revision=11421
This commit is contained in:
parent
1490258b3e
commit
3e7bf7cfb5
@ -432,6 +432,8 @@ void cookies_remove(const struct cookie_data *data)
|
||||
*/
|
||||
void cookies_cleanup(void)
|
||||
{
|
||||
hlcache_handle_release(folder_icon);
|
||||
hlcache_handle_release(cookie_icon);
|
||||
}
|
||||
|
||||
/* Actions to be connected to front end specific toolbars */
|
||||
|
@ -317,6 +317,8 @@ unsigned int history_global_get_tree_flags(void)
|
||||
*/
|
||||
void history_global_cleanup(void)
|
||||
{
|
||||
hlcache_handle_release(folder_icon);
|
||||
tree_url_node_cleanup();
|
||||
}
|
||||
|
||||
|
||||
|
@ -205,6 +205,8 @@ unsigned int hotlist_get_tree_flags(void)
|
||||
void hotlist_cleanup(const char *hotlist_path)
|
||||
{
|
||||
hotlist_export(hotlist_path);
|
||||
hlcache_handle_release(folder_icon);
|
||||
tree_url_node_cleanup();
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "desktop/browser.h"
|
||||
#include "desktop/gui.h"
|
||||
#include "desktop/options.h"
|
||||
#include "desktop/searchweb.h"
|
||||
#include "utils/log.h"
|
||||
#include "utils/url.h"
|
||||
#include "utils/utf8.h"
|
||||
@ -176,6 +177,8 @@ void netsurf_exit(void)
|
||||
{
|
||||
LOG(("Closing GUI"));
|
||||
gui_quit();
|
||||
LOG(("Closing search and related resources"));
|
||||
search_web_cleanup();
|
||||
LOG(("Finalising high-level cache"));
|
||||
hlcache_finalise();
|
||||
LOG(("Finalising low-level cache"));
|
||||
|
@ -267,6 +267,17 @@ hlcache_handle *search_web_ico(void)
|
||||
return search_ico;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up any remaining resources during shutdown.
|
||||
*/
|
||||
void search_web_cleanup(void)
|
||||
{
|
||||
if (search_ico != NULL) {
|
||||
hlcache_handle_release(search_ico);
|
||||
search_ico = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* callback function to cache ico then notify front when successful
|
||||
* else retry default from local file system
|
||||
|
@ -75,4 +75,6 @@ void search_web_retrieve_ico(bool localdefault);
|
||||
|
||||
struct hlcache_handle *search_web_ico(void);
|
||||
|
||||
void search_web_cleanup(void);
|
||||
|
||||
#endif
|
||||
|
@ -78,6 +78,7 @@ unsigned int sslcert_get_tree_flags(void)
|
||||
|
||||
void sslcert_cleanup(void)
|
||||
{
|
||||
hlcache_handle_release(sslcert_icon);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -102,12 +102,15 @@ struct icon_entry icon_table[] = {
|
||||
{CONTENT_HTML, NULL}
|
||||
};
|
||||
|
||||
static uint32_t tun_users = 0;
|
||||
|
||||
void tree_url_node_init(const char *folder_icon_name)
|
||||
{
|
||||
struct icon_entry *entry;
|
||||
char icon_name[MAX_ICON_NAME_LEN];
|
||||
|
||||
|
||||
tun_users++;
|
||||
|
||||
if (initialised || option_tree_icons_dir == NULL)
|
||||
return;
|
||||
initialised = true;
|
||||
@ -122,10 +125,31 @@ void tree_url_node_init(const char *folder_icon_name)
|
||||
|
||||
++entry;
|
||||
} while (entry->type != CONTENT_HTML);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void tree_url_node_cleanup()
|
||||
{
|
||||
struct icon_entry *entry;
|
||||
|
||||
tun_users--;
|
||||
|
||||
if (tun_users > 0)
|
||||
return;
|
||||
|
||||
if (!initialised)
|
||||
return;
|
||||
initialised = false;
|
||||
|
||||
hlcache_handle_release(folder_icon);
|
||||
|
||||
entry = icon_table;
|
||||
do {
|
||||
hlcache_handle_release(entry->icon);
|
||||
++entry;
|
||||
} while (entry->type != CONTENT_HTML);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a tree entry for a URL, and links it into the tree
|
||||
*
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "desktop/tree.h"
|
||||
|
||||
void tree_url_node_init(const char *folder_icon_name);
|
||||
void tree_url_node_cleanup(void);
|
||||
struct node *tree_create_URL_node(struct tree *tree,
|
||||
struct node *parent, const char *url, const char *title,
|
||||
tree_node_user_callback, void *callback_data);
|
||||
|
Loading…
Reference in New Issue
Block a user