explain why we attach/detach native impl. in setParent

This commit is contained in:
Myk Melez 2014-10-28 17:26:49 -07:00
Родитель 1d1155fac2
Коммит aaa94a950e
1 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -18,6 +18,12 @@ public abstract class CanvasItem {
parent = theParent; parent = theParent;
// We need to attach/detach the native implementation at some point.
// We initially considered init/finalize, but our VM doesn't appear
// to ever call finalize. So we do it here, attaching the native impl.
// when setParent is called with an object reference, then detaching it
// when setParent is called with a null value; which appears to be
// expected usage when creating/destroying CanvasItem objects.
if (parent != null) { if (parent != null) {
attachNativeImpl(); attachNativeImpl();
} else { } else {