Skip to content

Commit

Permalink
[TIMOB-26202] Fix Ti.UI.Window references
Browse files Browse the repository at this point in the history
  • Loading branch information
Gary Mathews committed Jul 21, 2018
1 parent c097d7b commit abc1b78
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,7 @@ private void cleanupSections()
{
ArrayList<TableViewSectionProxy> sections = getSectionsArray();
for (TableViewSectionProxy section : sections) {
section.releaseViews();
section.setParent(null);
}
sections.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@ public void releaseViews()
{
super.releaseViews();

if (tableViewItem != null) {
tableViewItem.release();
tableViewItem = null;
}
if (controls != null) {
for (TiViewProxy control : controls) {
control.releaseKroll();
Expand All @@ -288,10 +292,6 @@ public void release()

releaseViews();

if (tableViewItem != null) {
tableViewItem.release();
tableViewItem = null;
}
if (controls != null) {
controls.clear();
controls = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,9 @@ public void release()
views.clear();
views = null;
}
if (item != null) {
item = null;
}
if (content != null) {
content.removeAllViews();
content = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1571,14 +1571,19 @@ protected void onDestroy()

//LW windows
if (window == null && view != null) {
view.releaseViews();
view.release();
view = null;
}
if (view != null) {
view.releaseViews();
view = null;
}

if (window != null) {
if (windowStack.contains(window)) {
removeWindowFromStack(window);
}
window.closeFromActivity(isFinishing);
window.releaseViews();
window.releaseKroll();
window = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,13 @@ public void releaseViews()
KrollRuntime.suggestGC();
}

@Override
public void release()
{
releaseViews();
super.release();
}

/**
* Implementing classes should use this method to create and return the appropriate view.
* @param activity the context activity.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -525,4 +525,24 @@ protected boolean hasActivityTransitions()
final boolean animated = TiConvert.toBoolean(getProperties(), TiC.PROPERTY_ANIMATED, true);
return (LOLLIPOP_OR_GREATER && animated && sharedElementPairs != null && !sharedElementPairs.isEmpty());
}

@Override
public void releaseViews()
{
if (view != null) {
if (children != null) {
for (TiViewProxy p : children) {
p.releaseViews();
}
}
view = null;
}
if (runtimeHandler != null) {
runtimeHandler = null;
}
if (mainHandler != null) {
mainHandler = null;
}
setModelListener(null);
}
}

0 comments on commit abc1b78

Please sign in to comment.