summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2010-04-11 19:49:58 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2010-04-11 19:49:58 +0000
commit85e3fc7fc05dd06683ef0898c45a58e9237164d6 (patch)
tree276fa8d4158de9017e4973d0b2b2e8943cc1b995
parentd12ddbec488a7b3ca5f79dcc8de17de18b82882f (diff)
downloadlibcss-85e3fc7fc05dd06683ef0898c45a58e9237164d6.tar.gz
libcss-85e3fc7fc05dd06683ef0898c45a58e9237164d6.tar.bz2
Ownership of imported stylesheets is retained by the client.
svn path=/trunk/libcss/; revision=10367
-rw-r--r--src/stylesheet.c5
-rw-r--r--test/css21.c2
-rw-r--r--test/parse-auto.c2
3 files changed, 6 insertions, 3 deletions
diff --git a/src/stylesheet.c b/src/stylesheet.c
index 52f2eed..20cc91f 100644
--- a/src/stylesheet.c
+++ b/src/stylesheet.c
@@ -340,7 +340,7 @@ css_error css_stylesheet_next_pending_import(css_stylesheet *parent,
* CSS_INVALID if there are no outstanding imports,
* appropriate error otherwise.
*
- * Ownership of the imported stylesheet is transferred to the parent.
+ * Ownership of the imported stylesheet is retained by the client.
*/
css_error css_stylesheet_register_import(css_stylesheet *parent,
css_stylesheet *import)
@@ -965,8 +965,7 @@ css_error css_stylesheet_rule_destroy(css_stylesheet *sheet, css_rule *rule)
lwc_string_unref(import->url);
- if (import->sheet != NULL)
- css_stylesheet_destroy(import->sheet);
+ /* Do not destroy imported sheet: it is owned by the client */
}
break;
case CSS_RULE_MEDIA:
diff --git a/test/css21.c b/test/css21.c
index f969603..14217e7 100644
--- a/test/css21.c
+++ b/test/css21.c
@@ -121,6 +121,8 @@ int main(int argc, char **argv)
assert(css_stylesheet_register_import(sheet,
import) == CSS_OK);
+ css_stylesheet_destroy(import);
+
error = CSS_IMPORTS_PENDING;
}
}
diff --git a/test/parse-auto.c b/test/parse-auto.c
index 0a3ae10..c15f572 100644
--- a/test/parse-auto.c
+++ b/test/parse-auto.c
@@ -542,6 +542,8 @@ void validate_rule_import(css_rule_import *s, exp_entry *e, int testnum)
e->name);
assert(0 && "Mismatched URLs");
}
+
+ css_stylesheet_destroy(s->sheet);
}
void dump_selector_list(css_selector *list, char **ptr)