Skip to content
Commit 0d855d0d authored by Oliver Kellogg's avatar Oliver Kellogg
Browse files

Fix "Pascal code import is very slow"

umbrello/umllistviewitem.{h,cpp}
- Remove empty reimplementation of destructor (we want the parent
  destructor to execute).
- Member m_comap is renamed to s_comap, changed to `static`, and is
  changed pointer. It now acts as a global map for all UMLObjects
  pertaining to the list view. The switch to pointer is done for
  reducing risk of static initialization order problems.
- New static function deleteItem removes the given UMLListViewItem from
  s_comap and calls its destructor.
- At function findChildObject add `const` on argument `child`.
- New protected function findUMLObject_r is auxiliary to findUMLObject.
  It is invoked when the given object is not found in s_comap.
- Change implementation of ChildObjectMap from QMap to QHash.
  Reason: QHash is more appropriate for pointer arguments.

umbrello/umllistviewitem.cpp
- In function init() allocate s_comap if null.
- Adjust functions addChildItem, deleteChildItem, deepCopy to the
  changes related to m_comap -> s_comap.

umbrello/umllistview.cpp
- In function slotObjectCreated add calls to parentItem->addChildItem()
  for updating s_comap.
- In function slotObjectRemoved replace destruction of `item` by call to
  deleteItem() in order to update s_comap.
- In function init(),
  - reduce content of `if (m_rv == 0)`;
  - call clean() unconditionally;
  - execute for-loop over N_MODELTYPES unconditionally and in its body
    add call to m_rv->addChildItem(sysFolder, m_lv[i]) for updating
    s_comap;
  - call m_lv[Uml::ModelType::Logical]->addChildItem(datatypeFolder) for
    updating s_comap with m_datatypeFolder.
- In function clean(),
  - clean up documentation;
  - set m_datatypeFolder to 0;
  - in for-loop over N_MODELTYPES remove call to deleteChildrenOf() and
    add setting of m_lv[i] to 0;
  - call deleteChildrenOf(m_rv).
- In function moveObject,
  - remove handling of m_doc->loading() (see function acceptDrag);
  - replace `delete move` by UMLListViewItem::deleteItem(move) for
    updating s_comap;
  - add handling of case UMLListViewItem::lvt_EnumLiteral.
- In function addNewItem case instanceOfClass add call to
  instanceItem->addChildItem() for updating s_comap.
- In function loadChildrenFromXMI loading of structural objects add
  call to parent->addChildItem() to update s_comap.
- In function deleteChildrenOf case (typeIsCanvasWidget(lvt) ||
  typeIsClassifierList(lvt)) case !object, replace `delete temp` by call
  to UMLListViewItem::deleteItem(temp).

BUG: 449465
FIXED-IN: 2.34.70 (KDE releases 22.07.70)
parent 406f3e81
Pipeline #190246 failed with stage
in 6 minutes and 10 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment