summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorNathan Lee <2431820-nathanal@users.noreply.gitlab.com>2019-10-12 13:32:01 +0000
committerMarc Jeanmougin <marcjeanmougin@free.fr>2019-10-14 14:57:01 +0000
commit1ab498123160610db92757d4b663644ec4c6deda (patch)
tree9a6de5868145446c9a8d5b65d8c9b235d5e0ddb8 /src/ui
parentRe-Add blending modes UI using CSS instead filters (diff)
downloadinkscape-1ab498123160610db92757d4b663644ec4c6deda.tar.gz
inkscape-1ab498123160610db92757d4b663644ec4c6deda.zip
Reduce memory leak in file preview
https://gitlab.com/inkscape/inkscape/issues/201
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/dialog/svg-preview.cpp14
-rw-r--r--src/ui/previewholder.cpp1
2 files changed, 9 insertions, 6 deletions
diff --git a/src/ui/dialog/svg-preview.cpp b/src/ui/dialog/svg-preview.cpp
index 97c53d8e5..012afc40c 100644
--- a/src/ui/dialog/svg-preview.cpp
+++ b/src/ui/dialog/svg-preview.cpp
@@ -39,15 +39,18 @@ namespace Dialog {
bool SVGPreview::setDocument(SPDocument *doc)
{
- document = doc;
-
if (viewer) {
- viewer->setDocument(document);
+ viewer->setDocument(doc);
} else {
- viewer = Gtk::manage(new Inkscape::UI::View::SVGViewWidget(document));
+ viewer = Gtk::manage(new Inkscape::UI::View::SVGViewWidget(doc));
pack_start(*viewer, true, true);
}
+ if (document) {
+ delete document;
+ }
+ document = doc;
+
show_all();
return true;
@@ -446,8 +449,7 @@ SVGPreview::SVGPreview()
set_size_request(200, 300);
}
-SVGPreview::~SVGPreview()
-= default;
+SVGPreview::~SVGPreview() { delete document; }
} // namespace Dialog
} // namespace UI
diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp
index 28fcc5c6b..2d6b8f8fc 100644
--- a/src/ui/previewholder.cpp
+++ b/src/ui/previewholder.cpp
@@ -357,6 +357,7 @@ void PreviewHolder::rebuildUI()
auto children = _insides->get_children();
for (auto child : children) {
_insides->remove(*child);
+ delete child;
}
_insides->set_column_spacing(0);