Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#14610 closed enhancement (fixed)

[patch][ccla]Add a dispose API to gfx

Reported by: Patrick Ruzand Owned by: Patrick Ruzand
Priority: high Milestone: 1.8
Component: DojoX GFX Version: 1.7.1
Keywords: Cc: cjolif
Blocked By: Blocking:

Description

When a shape is not used anymore, some clean up operations might be needed to free resources and avoid leaks. One of the clean up tasks is for example to remove the shape from the ids registry (a hashmap that maps an idea to a shape instance, see dojox.gfx.shape.register). This cleanup operation cannot be done automatically on a container.clear/remove because removing a shape does not imply that the user wants to get rid of it (it might be a temporary state).

This enhancement ticket propose to add a dispose() api on the Shape class that would run the required cleanup tasks when called. Also, the clear/remove method signature could be updated to accept a extra boolean parameter indicating whether the node should be disposed.

see #14589

Attachments (2)

14610.patch (10.9 KB) - added by Patrick Ruzand 8 years ago.
patch (by pruzand, IBM, CCLA)
test_lifecycle2.html (2.1 KB) - added by Patrick Ruzand 8 years ago.
a test case that endlessly create/destroy gfx hierarchy (100 objects) to track mlk.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 8 years ago by cjolif

Cc: cjolif added

Changed 8 years ago by Patrick Ruzand

Attachment: 14610.patch added

patch (by pruzand, IBM, CCLA)

comment:2 Changed 8 years ago by Patrick Ruzand

Summary: Add a dispose API to gfx[patch][ccla]Add a dispose API to gfx

comment:3 Changed 8 years ago by Patrick Ruzand

Status: newassigned

The proposed patch introduces a new Shape.destroy()* API that handles cleanup operations. In addition, Container.clear() has a new (optional) boolean parameter that indicates whether the children of a Group should be destroyed during the clear() operation. Note that before a shape is destroyed, it should be removed from its parent (this is done automatically by the Group for its children).

*: the new api is named destroy() and not dispose() as initially proposed for the sake of consistency with the existing Surface.destroy() method that has the very same purpose.

Changed 8 years ago by Patrick Ruzand

Attachment: test_lifecycle2.html added

a test case that endlessly create/destroy gfx hierarchy (100 objects) to track mlk.

comment:4 Changed 8 years ago by Patrick Ruzand

Resolution: fixed
Status: assignedclosed

In [28308]:

add destructor API (Shape.destroy()). fixes #14610 !strict

comment:5 Changed 8 years ago by Patrick Ruzand

In [28309]:

update Element.purgeGroup to use new gfx destroy() api. refs #14589,#14610 !strict

Note: See TracTickets for help on using tickets.