From: buliabyak Date: Tue, 16 Sep 2008 16:31:48 +0000 (+0000) Subject: remove extra unref; now ref/unref is done by show/hide; this used to stop this arenai... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f9e66b5deb95d8fcf8a766ecdaeaca0fa049baaf;p=inkscape.git remove extra unref; now ref/unref is done by show/hide; this used to stop this arenaitem from leaking, but this is now fixed properly in SPItem --- diff --git a/src/desktop.cpp b/src/desktop.cpp index 476f1e3d7..5267bca57 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -270,7 +270,6 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas) SP_ITEM_SHOW_DISPLAY); if (ai) { nr_arena_item_add_child (SP_CANVAS_ARENA (drawing)->root, ai, NULL); - nr_arena_item_unref (ai); } namedview->show(this); @@ -1399,7 +1398,6 @@ SPDesktop::setDocument (SPDocument *doc) SP_ITEM_SHOW_DISPLAY); if (ai) { nr_arena_item_add_child (SP_CANVAS_ARENA (drawing)->root, ai, NULL); - nr_arena_item_unref (ai); } namedview->show(this); /* Ugly hack */ diff --git a/src/extension/internal/cairo-pdf-out.cpp b/src/extension/internal/cairo-pdf-out.cpp index 93dad1e64..ac598b9a0 100644 --- a/src/extension/internal/cairo-pdf-out.cpp +++ b/src/extension/internal/cairo-pdf-out.cpp @@ -93,7 +93,6 @@ pdf_print_document_to_file(SPDocument *doc, gchar const *filename, unsigned int /* Release arena */ sp_item_invoke_hide(mod->base, mod->dkey); mod->base = NULL; - nr_arena_item_unref(mod->root); mod->root = NULL; nr_object_unref((NRObject *) mod->arena); mod->arena = NULL; diff --git a/src/extension/internal/cairo-png-out.cpp b/src/extension/internal/cairo-png-out.cpp index 6a7295dd8..744d59f75 100644 --- a/src/extension/internal/cairo-png-out.cpp +++ b/src/extension/internal/cairo-png-out.cpp @@ -77,7 +77,6 @@ png_render_document_to_file(SPDocument *doc, gchar const *filename) /* Release arena */ sp_item_invoke_hide(base, dkey); - nr_arena_item_unref(root); nr_object_unref((NRObject *) arena); /* end */ delete renderer; diff --git a/src/extension/internal/cairo-ps-out.cpp b/src/extension/internal/cairo-ps-out.cpp index 9776dafca..fba0ab571 100644 --- a/src/extension/internal/cairo-ps-out.cpp +++ b/src/extension/internal/cairo-ps-out.cpp @@ -97,7 +97,6 @@ ps_print_document_to_file(SPDocument *doc, gchar const *filename, unsigned int l /* Release arena */ sp_item_invoke_hide(base, dkey); - nr_arena_item_unref(root); nr_object_unref((NRObject *) arena); /* end */ delete renderer; diff --git a/src/extension/internal/cairo-renderer-pdf-out.cpp b/src/extension/internal/cairo-renderer-pdf-out.cpp index 96366e592..4e6c74dff 100644 --- a/src/extension/internal/cairo-renderer-pdf-out.cpp +++ b/src/extension/internal/cairo-renderer-pdf-out.cpp @@ -97,7 +97,6 @@ pdf_render_document_to_file(SPDocument *doc, gchar const *filename, unsigned int /* Release arena */ sp_item_invoke_hide(base, dkey); - nr_arena_item_unref(root); nr_object_unref((NRObject *) arena); /* end */ renderer->destroyContext(ctx); diff --git a/src/extension/internal/emf-win32-inout.cpp b/src/extension/internal/emf-win32-inout.cpp index d0e2e8810..8dd793f92 100644 --- a/src/extension/internal/emf-win32-inout.cpp +++ b/src/extension/internal/emf-win32-inout.cpp @@ -136,7 +136,6 @@ emf_print_document_to_file(SPDocument *doc, gchar const *filename) /* Release arena */ sp_item_invoke_hide(mod->base, mod->dkey); mod->base = NULL; - nr_arena_item_unref(mod->root); mod->root = NULL; nr_object_unref((NRObject *) mod->arena); mod->arena = NULL; diff --git a/src/extension/internal/latex-pstricks-out.cpp b/src/extension/internal/latex-pstricks-out.cpp index 2dced1d32..8d89951ce 100644 --- a/src/extension/internal/latex-pstricks-out.cpp +++ b/src/extension/internal/latex-pstricks-out.cpp @@ -77,7 +77,6 @@ LatexOutput::save (Inkscape::Extension::Output *mod2, SPDocument *doc, const gch /* Release arena */ sp_item_invoke_hide (mod->base, mod->dkey); mod->base = NULL; - nr_arena_item_unref (mod->root); mod->root = NULL; nr_object_unref ((NRObject *) mod->arena); mod->arena = NULL; diff --git a/src/flood-context.cpp b/src/flood-context.cpp index 1057fd4be..22eee6468 100644 --- a/src/flood-context.cpp +++ b/src/flood-context.cpp @@ -874,7 +874,6 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even // Hide items sp_item_invoke_hide(SP_ITEM(sp_document_root(document)), dkey); - nr_arena_item_unref(root); nr_object_unref((NRObject *) arena); guchar *trace_px = g_new(guchar, width * height); diff --git a/src/helper/png-write.cpp b/src/helper/png-write.cpp index 84816ad9c..dd42e9ca1 100644 --- a/src/helper/png-write.cpp +++ b/src/helper/png-write.cpp @@ -386,11 +386,10 @@ sp_export_png_file(SPDocument *doc, gchar const *filename, g_free(ebp.px); } - // Hide items + // Hide items, this releases arenaitem sp_item_invoke_hide(SP_ITEM(sp_document_root(doc)), dkey); - /* Free Arena and ArenaItem */ - nr_arena_item_unref(ebp.root); + /* Free arena */ nr_object_unref((NRObject *) arena); // restore saved blur quality diff --git a/src/print.cpp b/src/print.cpp index 7b032fe4e..044dffe34 100644 --- a/src/print.cpp +++ b/src/print.cpp @@ -113,7 +113,6 @@ sp_print_preview_document(SPDocument *doc) /* Release arena */ sp_item_invoke_hide(mod->base, mod->dkey); mod->base = NULL; - nr_arena_item_unref(mod->root); mod->root = NULL; nr_object_unref((NRObject *) mod->arena); mod->arena = NULL; @@ -140,7 +139,6 @@ sp_print_document(Gtk::Window& parentWindow, SPDocument *doc) // Release arena sp_item_invoke_hide(base, dkey); - nr_arena_item_unref(root); nr_object_unref((NRObject *) arena); } @@ -175,7 +173,6 @@ sp_print_document_to_file(SPDocument *doc, gchar const *filename) /* Release arena */ sp_item_invoke_hide(mod->base, mod->dkey); mod->base = NULL; - nr_arena_item_unref(mod->root); mod->root = NULL; nr_object_unref((NRObject *) mod->arena); mod->arena = NULL; diff --git a/src/sp-clippath.cpp b/src/sp-clippath.cpp index f56564cbe..a412694b3 100644 --- a/src/sp-clippath.cpp +++ b/src/sp-clippath.cpp @@ -171,7 +171,6 @@ sp_clippath_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape:: SP_ITEM_REFERENCE_FLAGS); if (ac) { nr_arena_item_add_child(v->arenaitem, ac, NULL); - nr_arena_item_unref(ac); } } } @@ -271,7 +270,6 @@ sp_clippath_show(SPClipPath *cp, NRArena *arena, unsigned int key) if (ac) { /* The order is not important in clippath */ nr_arena_item_add_child(ai, ac, NULL); - nr_arena_item_unref(ac); } } } diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 38bf03bdc..cd3019d8e 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -605,7 +605,6 @@ void CGroup::onChildAdded(Inkscape::XML::Node *child) { if (ac) { nr_arena_item_append_child (v->arenaitem, ac); - nr_arena_item_unref (ac); } } } @@ -624,7 +623,6 @@ void CGroup::onChildAdded(Inkscape::XML::Node *child) { if (ac) { nr_arena_item_add_child (v->arenaitem, ac, NULL); nr_arena_item_set_order (ac, position); - nr_arena_item_unref (ac); } } } @@ -774,7 +772,6 @@ void CGroup::_showChildren (NRArena *arena, NRArenaItem *ai, unsigned int key, u if (ac) { nr_arena_item_add_child (ai, ac, ar); ar = ac; - nr_arena_item_unref (ac); } } l = g_slist_remove (l, o); diff --git a/src/sp-mask.cpp b/src/sp-mask.cpp index c6febeb40..49a40f4ca 100644 --- a/src/sp-mask.cpp +++ b/src/sp-mask.cpp @@ -186,7 +186,6 @@ sp_mask_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML SP_ITEM_REFERENCE_FLAGS); if (ac) { nr_arena_item_add_child (v->arenaitem, ac, NULL); - nr_arena_item_unref (ac); } } } @@ -318,7 +317,6 @@ sp_mask_show (SPMask *mask, NRArena *arena, unsigned int key) if (ac) { /* The order is not important in mask */ nr_arena_item_add_child (ai, ac, NULL); - nr_arena_item_unref (ac); } } } diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp index f89562d25..f7c8a03fc 100644 --- a/src/sp-pattern.cpp +++ b/src/sp-pattern.cpp @@ -724,7 +724,6 @@ sp_pattern_painter_new (SPPaintServer *ps, NR::Matrix const &full_transform, NR: NRArenaItem *cai; cai = sp_item_invoke_show (SP_ITEM (child), pp->arena, pp->dkey, SP_ITEM_REFERENCE_FLAGS); nr_arena_item_append_child (pp->root, cai); - nr_arena_item_unref (cai); } } break; // do not go further up the chain if children are found diff --git a/src/sp-switch.cpp b/src/sp-switch.cpp index 9be85785d..37be6f75e 100644 --- a/src/sp-switch.cpp +++ b/src/sp-switch.cpp @@ -172,7 +172,6 @@ void CSwitch::_showChildren (NRArena *arena, NRArenaItem *ai, unsigned int key, if (ac) { nr_arena_item_add_child (ai, ac, ar); ar = ac; - nr_arena_item_unref (ac); } } l = g_slist_remove (l, o); diff --git a/src/sp-use.cpp b/src/sp-use.cpp index 2af7e1394..50b657728 100644 --- a/src/sp-use.cpp +++ b/src/sp-use.cpp @@ -344,7 +344,6 @@ sp_use_show(SPItem *item, NRArena *arena, unsigned key, unsigned flags) NRArenaItem *ac = sp_item_invoke_show(SP_ITEM(use->child), arena, key, flags); if (ac) { nr_arena_item_add_child(ai, ac, NULL); - nr_arena_item_unref(ac); } NR::translate t(use->x.computed, use->y.computed); @@ -529,7 +528,6 @@ sp_use_href_changed(SPObject */*old_ref*/, SPObject */*ref*/, SPUse *use) ai = sp_item_invoke_show(SP_ITEM(use->child), NR_ARENA_ITEM_ARENA(v->arenaitem), v->key, v->flags); if (ai) { nr_arena_item_add_child(v->arenaitem, ai, NULL); - nr_arena_item_unref(ai); } } diff --git a/src/svg-view.cpp b/src/svg-view.cpp index 1ca269d70..c4e35a2c9 100644 --- a/src/svg-view.cpp +++ b/src/svg-view.cpp @@ -208,7 +208,6 @@ SPSVGView::setDocument (SPDocument *document) if (ai) { nr_arena_item_add_child (SP_CANVAS_ARENA (_drawing)->root, ai, NULL); - nr_arena_item_unref (ai); } doRescale (!_rescale); diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index ab0a8ec63..e2d044908 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -913,7 +913,6 @@ bool FileOpenDialogImplWin32::set_svg_preview() // Tidy up sp_document_unref(svgDoc); sp_item_invoke_hide((SPItem*)(svgDoc->root), key); - nr_arena_item_unref(root); nr_object_unref((NRObject *) arena); // Create the GDK pixbuf