if stack creates the component, is the owner too

leak--
This commit is contained in:
Marco Martin 2011-10-31 14:08:03 +01:00
parent f050e056ec
commit 3ac2a8c875
2 changed files with 13 additions and 7 deletions

View File

@ -150,7 +150,11 @@ function initPage(page, properties) {
}
container.page = page;
if (page.parent == null) {
container.owner = container;
} else {
container.owner = page.parent;
}
// the page has to be reparented if
if (page.parent != container) {

View File

@ -177,8 +177,8 @@ Item {
// The owner of the page.
property Item owner: null
// The width of the longer screen dimension
property int screenWidth: Math.max(screen.width, screen.height)
// The width of the longer stack dimension
property int stackWidth: Math.max(root.width, root.height)
// Duration of transition animation (in ms)
property int transitionDuration: 250
@ -314,7 +314,7 @@ Item {
// when exiting portrait and entering landscape.
State {
name: "LandscapeLeft"
PropertyChanges { target: container; x: -screenWidth / 2; opacity: 0 }
PropertyChanges { target: container; x: -stackWidth / 2; opacity: 0 }
},
// Start state for push entry, end state for pop exit.
State {
@ -325,7 +325,7 @@ Item {
// when exiting portrait and entering landscape.
State {
name: "LandscapeRight"
PropertyChanges { target: container; x: screenWidth / 2; opacity: 0 }
PropertyChanges { target: container; x: stackWidth / 2; opacity: 0 }
},
// Inactive state.
State {
@ -443,14 +443,16 @@ Item {
function cleanup()
{
if (page != null) {
if (page.status == PageStatus.Active)
internal.setPageStatus(page, PageStatus.Inactive);
if (page.status == PageStatus.Active) {
internal.setPageStatus(page, PageStatus.Inactive)
}
if (owner != container) {
// container is not the owner of the page - re-parent back to original owner
page.visible = false;
page.parent = owner;
}
}
print("KILLING"+container+" "+page+" "+owner)
container.destroy();
}
}