Unable to remove math node

Bug #1379453 reported by Bowen Li
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Workcraft
Fix Committed
Low
Stan

Bug Description

Removing a visual component in a page cannot remove its corresponding math node.
using lp:~libowen96/workcraft/trunk-son-refactoring
- create some places in Petri net plug-in
- combine them into a page
- enter the page and remove one place
- use Tool -> Test tool -> Math level test to output all math places
The removed node still exist.

Tags: page son

Related branches

Changed in workcraft:
importance: Undecided → Low
status: New → Confirmed
assignee: nobody → Stan (sgaflv)
tags: added: page son
Stan (sgaflv)
Changed in workcraft:
status: Confirmed → Fix Committed
Revision history for this message
Danil Sokolov (danilovesky) wrote :

The methods inRef and decRef in DefaultMathNodeRemover that were based on a reference counting are changed to track the sets of dependant nodes:

private void addReference(MathNode mathNode, DependentNode dependentNode) {
  if (mathNode != null) {
   HashSet<DependentNode> refs = referenceTracker.get(mathNode);
   if (refs == null) {
    refs = new HashSet<DependentNode>();
    referenceTracker.put(mathNode ,refs);
   }
   refs.add(dependentNode);
  }
 }

 private void removeReference(MathNode mathNode, DependentNode dependentNode) {
  if (mathNode != null) {
   HashSet<DependentNode> refs = referenceTracker.get(mathNode);
   if (refs != null) {
    refs.remove(dependentNode);
   }
   if ((refs == null) || refs.isEmpty()) {
    referenceTracker.remove(mathNode);
    Node parent = mathNode.getParent();
    if (parent instanceof Container) {
     ((Container)parent).remove(mathNode);
    }
   }
  }
 }

Changed in workcraft:
milestone: none → 3.0.3
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.