Fix decorator reload crash.
- SetTopTap() -> SetTopTab(). - When reloading the decor, if the window in question is borderless, short circuit. Previously, we wouldn't allocate a decorator for such a window, but would then go through the remaining steps of attempting to set the focus/top tab, which would obviously crash. Fixes #8500 and possibly others. - Add error check that adding tabs to the decorator actually succeeded.
This commit is contained in:
@@ -602,10 +602,14 @@ Window::ReloadDecor()
|
||||
Window* window = stack->WindowAt(i);
|
||||
BRegion dirty;
|
||||
DesktopSettings settings(fDesktop);
|
||||
decorator->AddTab(settings, window->Title(), window->Look(),
|
||||
window->Flags(), -1, &dirty);
|
||||
if (decorator->AddTab(settings, window->Title(), window->Look(),
|
||||
window->Flags(), -1, &dirty) == NULL) {
|
||||
delete decorator;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
return true;
|
||||
|
||||
windowBehaviour = gDecorManager.AllocateWindowBehaviour(this);
|
||||
if (windowBehaviour == NULL) {
|
||||
@@ -624,7 +628,7 @@ Window::ReloadDecor()
|
||||
if (window->IsFocus())
|
||||
decorator->SetFocus(i, true);
|
||||
if (window == stack->TopLayerWindow())
|
||||
decorator->SetTopTap(i);
|
||||
decorator->SetTopTab(i);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -2111,7 +2115,7 @@ Window::DetachFromWindowStack(bool ownStackNeeded)
|
||||
::Decorator* decorator = fCurrentStack->Decorator();
|
||||
if (decorator != NULL) {
|
||||
decorator->RemoveTab(index);
|
||||
decorator->SetTopTap(fCurrentStack->LayerOrder().CountItems() - 1);
|
||||
decorator->SetTopTab(fCurrentStack->LayerOrder().CountItems() - 1);
|
||||
}
|
||||
|
||||
Window* remainingTop = fCurrentStack->TopLayerWindow();
|
||||
@@ -2230,7 +2234,7 @@ Window::MoveToTopStackLayer()
|
||||
return false;
|
||||
decorator->SetDrawingEngine(fDrawingEngine);
|
||||
SetLook(Look(), NULL);
|
||||
decorator->SetTopTap(PositionInStack());
|
||||
decorator->SetTopTab(PositionInStack());
|
||||
return fCurrentStack->MoveToTopLayer(this);
|
||||
}
|
||||
|
||||
@@ -2248,7 +2252,7 @@ Window::MoveToStackPosition(int32 to, bool isMoving)
|
||||
::Decorator* decorator = Decorator();
|
||||
if (decorator && decorator->MoveTab(index, to, isMoving, &dirty) == false)
|
||||
return false;
|
||||
|
||||
|
||||
fDesktop->RebuildAndRedrawAfterWindowChange(this, dirty);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ Decorator::TabAt(const BPoint& where) const
|
||||
|
||||
|
||||
void
|
||||
Decorator::SetTopTap(int32 tab)
|
||||
Decorator::SetTopTab(int32 tab)
|
||||
{
|
||||
fTopTab = fTabList.ItemAt(tab);
|
||||
}
|
||||
@@ -404,7 +404,7 @@ Decorator::SetTabLocation(int32 tab, float location, bool isShifting,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*! \brief Changes the focus value of the decorator
|
||||
|
||||
|
||||
@@ -89,11 +89,11 @@ public:
|
||||
virtual bool MoveTab(int32 from, int32 to, bool isMoving,
|
||||
BRegion* updateRegion = NULL);
|
||||
virtual int32 TabAt(const BPoint& where) const;
|
||||
Decorator::Tab* TabAt(int32 index) const
|
||||
Decorator::Tab* TabAt(int32 index) const
|
||||
{ return fTabList.ItemAt(index); }
|
||||
int32 CountTabs() const
|
||||
{ return fTabList.CountItems(); }
|
||||
void SetTopTap(int32 tab);
|
||||
void SetTopTab(int32 tab);
|
||||
|
||||
void SetDrawingEngine(DrawingEngine *driver);
|
||||
inline DrawingEngine* GetDrawingEngine() const
|
||||
|
||||
Reference in New Issue
Block a user