- The SATGroup has been deleted to early, that probably causes #8103. Holding a reference on the WindowArea (which hold a ref to the group) extends the lifetime till we are done.

- Fix some stayBelowMouse flags.
This commit is contained in:
czeidler 2011-11-29 10:30:42 +13:00
parent 00e081a1ec
commit d240743e9b
3 changed files with 10 additions and 11 deletions

View File

@ -883,19 +883,17 @@ SATGroup::RemoveWindow(SATWindow* window, bool stayBelowMouse)
if (!fSATWindowList.RemoveItem(window))
return false;
WindowArea* area = window->GetWindowArea();
if (area)
// We need the area a little bit longer because the area could hold the
// last reference to the group.
BReference<WindowArea> area = window->GetWindowArea();
if (area.Get() != NULL)
area->_RemoveWindow(window);
int32 windowCount = CountItems();
window->RemovedFromGroup(this, stayBelowMouse);
if (windowCount >= 2)
if (CountItems() >= 2)
WindowAt(0)->DoGroupLayout();
// Do nothing after removing the window from the group because this
// could have released the last reference and destroyed ourself.
return true;
}

View File

@ -141,7 +141,6 @@ SATWindow::RemovedFromGroup(SATGroup* group, bool stayBelowMouse)
if (group->CountItems() == 1)
group->WindowAt(0)->_RestoreOriginalSize(false);
fWindowArea = NULL;
return true;
}
@ -179,6 +178,8 @@ SATWindow::RemovedFromArea(WindowArea* area)
fWindow->DetachFromWindowStack(true);
for (int i = 0; i < fSATSnappingBehaviourList.CountItems(); i++)
fSATSnappingBehaviourList.ItemAt(i)->RemovedFromArea(area);
fWindowArea = NULL;
}

View File

@ -342,7 +342,7 @@ StackAndTile::WindowHidden(Window* window, bool fromMinimize)
if (group == NULL)
return;
if (fromMinimize == false && group->CountItems() > 1)
group->RemoveWindow(satWindow);
group->RemoveWindow(satWindow, false);
}
@ -412,7 +412,7 @@ StackAndTile::WindowFeelChanged(Window* window, window_feel feel)
if (!group)
return;
if (group->CountItems() > 1)
group->RemoveWindow(satWindow);
group->RemoveWindow(satWindow, false);
}
@ -488,7 +488,7 @@ StackAndTile::_StartSAT()
if (!group)
return;
group->RemoveWindow(fCurrentSATWindow);
group->RemoveWindow(fCurrentSATWindow, false);
// Bring window to the front. (in focus follow mouse this is not
// automatically the case)
_ActivateWindow(fCurrentSATWindow);