summaryrefslogtreecommitdiffstats
path: root/src/ui/view/view.cpp
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2008-09-21 22:24:48 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2008-09-21 22:24:48 +0000
commitad57986ffec5fd89afea77ac436e0c25364d0f20 (patch)
tree3cadda7bf13bb69f113682cd3e739cef3f62e368 /src/ui/view/view.cpp
parentrewrote the document list as a (SPDocument,use_count) map, incrementing use_c... (diff)
downloadinkscape-ad57986ffec5fd89afea77ac436e0c25364d0f20.tar.gz
inkscape-ad57986ffec5fd89afea77ac436e0c25364d0f20.zip
on closing and document change, if this was the last view on this document, delete document to free up memory
(bzr r6866)
Diffstat (limited to 'src/ui/view/view.cpp')
-rw-r--r--src/ui/view/view.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/ui/view/view.cpp b/src/ui/view/view.cpp
index 75b6c453b..1b498a846 100644
--- a/src/ui/view/view.cpp
+++ b/src/ui/view/view.cpp
@@ -84,9 +84,6 @@ View::View()
*/
View::~View()
{
- if (_doc) {
- inkscape_remove_document(_doc);
- }
_close();
}
@@ -101,7 +98,11 @@ void View::_close() {
if (_doc) {
_document_uri_set_connection.disconnect();
_document_resized_connection.disconnect();
- _doc = 0;
+ if (inkscape_remove_document(_doc)) {
+ // this was the last view of this document, so delete it
+ delete _doc;
+ }
+ _doc = NULL;
}
Inkscape::Verb::delete_all_view (this);
@@ -142,7 +143,10 @@ void View::setDocument(SPDocument *doc) {
if (_doc) {
_document_uri_set_connection.disconnect();
_document_resized_connection.disconnect();
- inkscape_remove_document(_doc);
+ if (inkscape_remove_document(_doc)) {
+ // this was the last view of this document, so delete it
+ delete _doc;
+ }
}
inkscape_add_document(doc);