summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--css/css.c12
-rw-r--r--css/css.h1
-rw-r--r--desktop/netsurf.c4
3 files changed, 15 insertions, 2 deletions
diff --git a/css/css.c b/css/css.c
index 3ec12304d..0964869a2 100644
--- a/css/css.c
+++ b/css/css.c
@@ -52,6 +52,16 @@ static css_error nscss_register_imports(struct content_css_data *c);
static css_error nscss_register_import(struct content_css_data *c,
const hlcache_handle *import);
+static css_stylesheet *blank_import;
+
+/**
+ * Clean up after the CSS subsystem
+ */
+void css_cleanup(void)
+{
+ if (blank_import != NULL)
+ css_stylesheet_destroy(blank_import);
+}
/**
* Initialise a CSS content
@@ -570,8 +580,6 @@ css_error nscss_register_import(struct content_css_data *c,
struct content *s = hlcache_handle_get_content(import);
sheet = s->data.css.sheet;
} else {
- static css_stylesheet *blank_import;
-
/* Create a blank sheet if needed. */
if (blank_import == NULL) {
css_stylesheet_params params;
diff --git a/css/css.h b/css/css.h
index 6725a0055..d2f1191e2 100644
--- a/css/css.h
+++ b/css/css.h
@@ -61,6 +61,7 @@ struct nscss_import {
uint64_t media; /**< Media types that sheet applies to */
};
+void css_cleanup(void);
bool nscss_create(struct content *c, const struct http_parameter *params);
diff --git a/desktop/netsurf.c b/desktop/netsurf.c
index d0b57b569..5258efe11 100644
--- a/desktop/netsurf.c
+++ b/desktop/netsurf.c
@@ -35,6 +35,7 @@
#include "content/fetch.h"
#include "content/hlcache.h"
#include "content/urldb.h"
+#include "css/css.h"
#include "desktop/netsurf.h"
#include "desktop/401login.h"
#include "desktop/browser.h"
@@ -181,6 +182,9 @@ void netsurf_exit(void)
LOG(("Closing GUI"));
gui_quit();
+ /* Clean up after CSS */
+ css_cleanup();
+
LOG(("Closing search and related resources"));
search_web_cleanup();