diff options
| author | Martin Owens <doctormo@gmail.com> | 2018-11-14 16:34:36 +0000 |
|---|---|---|
| committer | Martin Owens <doctormo@gmail.com> | 2018-11-14 16:34:36 +0000 |
| commit | 5f8d56ff387f88bd81bbc6f785be49efe6508a51 (patch) | |
| tree | aa73a408de45d284eda6d2c325a7c28c378a0fa6 | |
| parent | Add Ramon Miranda work on filter primitives symbolic icons (diff) | |
| download | inkscape-5f8d56ff387f88bd81bbc6f785be49efe6508a51.tar.gz inkscape-5f8d56ff387f88bd81bbc6f785be49efe6508a51.zip | |
Use better syntax, clean up before reloading and call SPObjet release
| -rw-r--r-- | src/object/sp-style-elem.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/object/sp-style-elem.cpp b/src/object/sp-style-elem.cpp index e0080e334..a307b110f 100644 --- a/src/object/sp-style-elem.cpp +++ b/src/object/sp-style-elem.cpp @@ -491,6 +491,11 @@ void SPStyleElem::read_content() { //Record each css statement as an SPStyle gint count = cr_stylesheet_nr_rules(style_sheet); + // Clean out any previous styles + for (auto& style:styles) + sp_style_unref(style); + styles.clear(); + for (gint x = 0; x < count; x++) { SPStyle *item = new SPStyle(nullptr, nullptr); CRStatement *statement = cr_stylesheet_statement_get_from_list(style_sheet, x); @@ -536,11 +541,10 @@ void SPStyleElem::build(SPDocument *document, Inkscape::XML::Node *repr) { } void SPStyleElem::release() { - while(!styles.empty()) { - auto style = styles.back(); + for (auto& style:styles) sp_style_unref(style); - styles.pop_back(); - } + styles.clear(); + SPObject::release(); } |
