Skip to content
This repository has been archived by the owner on Oct 14, 2019. It is now read-only.

Commit

Permalink
Unregister disposed objects
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Jun 19, 2014
1 parent ba816b3 commit 4277f03
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Binary file modified haxelib/haxeui.zip
Binary file not shown.
15 changes: 15 additions & 0 deletions src/haxe/ui/toolkit/console/HaxeUIConsoleFunctions.hx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class HaxeUIConsoleFunctions {
public static function dispose(target:Dynamic):Void {
var c:Component = getComponent(target);
if (c != null) {
unregisterObjects(c);
c.parent.removeChild(c);
}
}
Expand Down Expand Up @@ -255,4 +256,18 @@ class HaxeUIConsoleFunctions {
HaxeUIConsole.scripts.set(scriptRes, scriptData);
DC.logConfirmation("Script '" + scriptRes + "' saved");
}

private static function unregisterObjects(parent:Component):Void {
if (parent == null) {
return;
}

if (parent.id != null) {
DC.unregisterObject(parent.id);
}

for (child in parent.children) {
unregisterObjects(cast child);
}
}
}

0 comments on commit 4277f03

Please sign in to comment.