- 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)) if (!fSATWindowList.RemoveItem(window))
return false; return false;
WindowArea* area = window->GetWindowArea(); // We need the area a little bit longer because the area could hold the
if (area) // last reference to the group.
BReference<WindowArea> area = window->GetWindowArea();
if (area.Get() != NULL)
area->_RemoveWindow(window); area->_RemoveWindow(window);
int32 windowCount = CountItems();
window->RemovedFromGroup(this, stayBelowMouse); window->RemovedFromGroup(this, stayBelowMouse);
if (windowCount >= 2) if (CountItems() >= 2)
WindowAt(0)->DoGroupLayout(); 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; return true;
} }

View File

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

View File

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