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);
|
Window* window = stack->WindowAt(i);
|
||||||
BRegion dirty;
|
BRegion dirty;
|
||||||
DesktopSettings settings(fDesktop);
|
DesktopSettings settings(fDesktop);
|
||||||
decorator->AddTab(settings, window->Title(), window->Look(),
|
if (decorator->AddTab(settings, window->Title(), window->Look(),
|
||||||
window->Flags(), -1, &dirty);
|
window->Flags(), -1, &dirty) == NULL) {
|
||||||
|
delete decorator;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
|
return true;
|
||||||
|
|
||||||
windowBehaviour = gDecorManager.AllocateWindowBehaviour(this);
|
windowBehaviour = gDecorManager.AllocateWindowBehaviour(this);
|
||||||
if (windowBehaviour == NULL) {
|
if (windowBehaviour == NULL) {
|
||||||
@@ -624,7 +628,7 @@ Window::ReloadDecor()
|
|||||||
if (window->IsFocus())
|
if (window->IsFocus())
|
||||||
decorator->SetFocus(i, true);
|
decorator->SetFocus(i, true);
|
||||||
if (window == stack->TopLayerWindow())
|
if (window == stack->TopLayerWindow())
|
||||||
decorator->SetTopTap(i);
|
decorator->SetTopTab(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -2111,7 +2115,7 @@ Window::DetachFromWindowStack(bool ownStackNeeded)
|
|||||||
::Decorator* decorator = fCurrentStack->Decorator();
|
::Decorator* decorator = fCurrentStack->Decorator();
|
||||||
if (decorator != NULL) {
|
if (decorator != NULL) {
|
||||||
decorator->RemoveTab(index);
|
decorator->RemoveTab(index);
|
||||||
decorator->SetTopTap(fCurrentStack->LayerOrder().CountItems() - 1);
|
decorator->SetTopTab(fCurrentStack->LayerOrder().CountItems() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Window* remainingTop = fCurrentStack->TopLayerWindow();
|
Window* remainingTop = fCurrentStack->TopLayerWindow();
|
||||||
@@ -2230,7 +2234,7 @@ Window::MoveToTopStackLayer()
|
|||||||
return false;
|
return false;
|
||||||
decorator->SetDrawingEngine(fDrawingEngine);
|
decorator->SetDrawingEngine(fDrawingEngine);
|
||||||
SetLook(Look(), NULL);
|
SetLook(Look(), NULL);
|
||||||
decorator->SetTopTap(PositionInStack());
|
decorator->SetTopTab(PositionInStack());
|
||||||
return fCurrentStack->MoveToTopLayer(this);
|
return fCurrentStack->MoveToTopLayer(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2248,7 +2252,7 @@ Window::MoveToStackPosition(int32 to, bool isMoving)
|
|||||||
::Decorator* decorator = Decorator();
|
::Decorator* decorator = Decorator();
|
||||||
if (decorator && decorator->MoveTab(index, to, isMoving, &dirty) == false)
|
if (decorator && decorator->MoveTab(index, to, isMoving, &dirty) == false)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
fDesktop->RebuildAndRedrawAfterWindowChange(this, dirty);
|
fDesktop->RebuildAndRedrawAfterWindowChange(this, dirty);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ Decorator::TabAt(const BPoint& where) const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Decorator::SetTopTap(int32 tab)
|
Decorator::SetTopTab(int32 tab)
|
||||||
{
|
{
|
||||||
fTopTab = fTabList.ItemAt(tab);
|
fTopTab = fTabList.ItemAt(tab);
|
||||||
}
|
}
|
||||||
@@ -404,7 +404,7 @@ Decorator::SetTabLocation(int32 tab, float location, bool isShifting,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Changes the focus value of the decorator
|
/*! \brief Changes the focus value of the decorator
|
||||||
|
|
||||||
|
|||||||
@@ -89,11 +89,11 @@ public:
|
|||||||
virtual bool MoveTab(int32 from, int32 to, bool isMoving,
|
virtual bool MoveTab(int32 from, int32 to, bool isMoving,
|
||||||
BRegion* updateRegion = NULL);
|
BRegion* updateRegion = NULL);
|
||||||
virtual int32 TabAt(const BPoint& where) const;
|
virtual int32 TabAt(const BPoint& where) const;
|
||||||
Decorator::Tab* TabAt(int32 index) const
|
Decorator::Tab* TabAt(int32 index) const
|
||||||
{ return fTabList.ItemAt(index); }
|
{ return fTabList.ItemAt(index); }
|
||||||
int32 CountTabs() const
|
int32 CountTabs() const
|
||||||
{ return fTabList.CountItems(); }
|
{ return fTabList.CountItems(); }
|
||||||
void SetTopTap(int32 tab);
|
void SetTopTab(int32 tab);
|
||||||
|
|
||||||
void SetDrawingEngine(DrawingEngine *driver);
|
void SetDrawingEngine(DrawingEngine *driver);
|
||||||
inline DrawingEngine* GetDrawingEngine() const
|
inline DrawingEngine* GetDrawingEngine() const
|
||||||
|
|||||||
Reference in New Issue
Block a user