Sanitize memory management of KoXmlNodeData a little

Authored by kossebau.

Description

Sanitize memory management of KoXmlNodeData a little

Summary:

  1. Cleanup sharing of KoXmlNodeData objects

Many null DOM element types (as created by default constructor) did not get the
KoXmlNodeData::null instance to share, but a new separate instance, without any need.
Destructors tested for need for dereferencing on multiple levels instead of just in
the destructor of the central baseclass KoXmlNode. Additionally do the destructors try
to deal with superclasses having already removed the KoXmlNodeData instance, which points
to ownership of those instances not properly respected.
The KoXmlNodeData::null instance was excluded from dereferencing, but not from
referencing, which seems more a workaround. Testing for identity to KoXmlNodeData::null
was done both in the unref() call itself as well as before calling the unref() call.
The new code now uses KoXmlNodeData::null whereever possible. It also uses a parameter
to the constructor to KoXmlNodeData to define the initial ref count, to avoid further
unref() or ref() calls to adapt to the usage.

  1. Create subclass KoXmlDocumentData to KoXmlNodeData

It holds all properties and methods interesting only to the KoXmlDocument objects,
to reduce footprint of KoXmlNodeData and separate the setContent functionality more

  1. Deduplicate creating the DocumentTypeNode after setContent() success

Test Plan: All tests still pass, and different apps can load files as before.

Subscribers: Calligra-Devel-list

Differential Revision: https://phabricator.kde.org/D154

Details

Committed
kossebauJul 29 2015, 12:55 AM
Differential Revision
Restricted Differential Revision
Parents
R8:c68e00627fe5: Replace duplicated code for angle arithmetic
Branches
Unknown
Tags
Unknown