Fix crash when splitting a S&T group.
- Hold a ref to the old crossings till we cleaned up. - Additionally use a safer method to delete constraints. - Clean up.
This commit is contained in:
parent
83092a04a4
commit
7dd16a4c95
@ -47,7 +47,6 @@ WindowArea::WindowArea(Crossing* leftTop, Crossing* rightTop,
|
|||||||
fWidthConstraint(NULL),
|
fWidthConstraint(NULL),
|
||||||
fHeightConstraint(NULL)
|
fHeightConstraint(NULL)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -320,6 +319,12 @@ WindowArea::PropagateToGroup(SATGroup* group)
|
|||||||
if (!newLeftTop || !newRightTop || !newLeftBottom || !newRightBottom)
|
if (!newLeftTop || !newRightTop || !newLeftBottom || !newRightBottom)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// hold a ref to the crossings till we cleaned up everything
|
||||||
|
BReference<Crossing> oldLeftTop = fLeftTopCrossing;
|
||||||
|
BReference<Crossing> oldRightTop = fRightTopCrossing;
|
||||||
|
BReference<Crossing> oldLeftBottom = fLeftBottomCrossing;
|
||||||
|
BReference<Crossing> oldRightBottom = fRightBottomCrossing;
|
||||||
|
|
||||||
fLeftTopCrossing = newLeftTop;
|
fLeftTopCrossing = newLeftTop;
|
||||||
fRightTopCrossing = newRightTop;
|
fRightTopCrossing = newRightTop;
|
||||||
fLeftBottomCrossing = newLeftBottom;
|
fLeftBottomCrossing = newLeftBottom;
|
||||||
@ -331,6 +336,7 @@ WindowArea::PropagateToGroup(SATGroup* group)
|
|||||||
// manage constraints
|
// manage constraints
|
||||||
if (Init(group) == false)
|
if (Init(group) == false)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
oldGroup->fWindowAreaList.RemoveItem(this);
|
oldGroup->fWindowAreaList.RemoveItem(this);
|
||||||
for (int32 i = 0; i < fWindowList.CountItems(); i++) {
|
for (int32 i = 0; i < fWindowList.CountItems(); i++) {
|
||||||
SATWindow* window = fWindowList.ItemAt(i);
|
SATWindow* window = fWindowList.ItemAt(i);
|
||||||
@ -360,12 +366,15 @@ WindowArea::MoveToTopLayer(SATWindow* window)
|
|||||||
void
|
void
|
||||||
WindowArea::_UninitConstraints()
|
WindowArea::_UninitConstraints()
|
||||||
{
|
{
|
||||||
delete fMinWidthConstraint;
|
LinearSpec* linearSpec = fGroup->GetLinearSpec();
|
||||||
delete fMinHeightConstraint;
|
|
||||||
delete fMaxWidthConstraint;
|
linearSpec->RemoveConstraint(fMinWidthConstraint, true);
|
||||||
delete fMaxHeightConstraint;
|
linearSpec->RemoveConstraint(fMinHeightConstraint, true);
|
||||||
delete fWidthConstraint;
|
linearSpec->RemoveConstraint(fMaxWidthConstraint, true);
|
||||||
delete fHeightConstraint;
|
linearSpec->RemoveConstraint(fMaxHeightConstraint, true);
|
||||||
|
linearSpec->RemoveConstraint(fWidthConstraint, true);
|
||||||
|
linearSpec->RemoveConstraint(fHeightConstraint, true);
|
||||||
|
|
||||||
fMinWidthConstraint = NULL;
|
fMinWidthConstraint = NULL;
|
||||||
fMinHeightConstraint = NULL;
|
fMinHeightConstraint = NULL;
|
||||||
fMaxWidthConstraint = NULL;
|
fMaxWidthConstraint = NULL;
|
||||||
@ -1157,14 +1166,12 @@ SATGroup::_SplitGroupIfNecessary(WindowArea* removedArea)
|
|||||||
while (_FindConnectedGroup(neighbourWindows, removedArea, newGroup)) {
|
while (_FindConnectedGroup(neighbourWindows, removedArea, newGroup)) {
|
||||||
STRACE_SAT("Connected group found; %i window(s)\n",
|
STRACE_SAT("Connected group found; %i window(s)\n",
|
||||||
(int)newGroup.CountItems());
|
(int)newGroup.CountItems());
|
||||||
|
|
||||||
if (newGroup.CountItems() == 1
|
if (newGroup.CountItems() == 1
|
||||||
&& newGroup.ItemAt(0)->WindowList().CountItems() == 1) {
|
&& newGroup.ItemAt(0)->WindowList().CountItems() == 1) {
|
||||||
SATWindow* window = newGroup.ItemAt(0)->WindowList().ItemAt(0);
|
SATWindow* window = newGroup.ItemAt(0)->WindowList().ItemAt(0);
|
||||||
RemoveWindow(window);
|
RemoveWindow(window);
|
||||||
_EnsureGroupIsOnScreen(window->GetGroup());
|
_EnsureGroupIsOnScreen(window->GetGroup());
|
||||||
}
|
} else if (ownGroupProcessed)
|
||||||
else if (ownGroupProcessed)
|
|
||||||
_SpawnNewGroup(newGroup);
|
_SpawnNewGroup(newGroup);
|
||||||
else {
|
else {
|
||||||
_EnsureGroupIsOnScreen(this);
|
_EnsureGroupIsOnScreen(this);
|
||||||
|
@ -220,11 +220,9 @@ private:
|
|||||||
Constraint* fMinHeightConstraint;
|
Constraint* fMinHeightConstraint;
|
||||||
Constraint* fMaxWidthConstraint;
|
Constraint* fMaxWidthConstraint;
|
||||||
Constraint* fMaxHeightConstraint;
|
Constraint* fMaxHeightConstraint;
|
||||||
Constraint* fKeepMaxWidthConstraint;
|
|
||||||
Constraint* fKeepMaxHeightConstraint;
|
|
||||||
Constraint* fWidthConstraint;
|
Constraint* fWidthConstraint;
|
||||||
Constraint* fHeightConstraint;
|
Constraint* fHeightConstraint;
|
||||||
|
|
||||||
MagneticBorder fMagneticBorder;
|
MagneticBorder fMagneticBorder;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user