SATGroup: fix misuse of BReferenceable object
LinearSpec is a BReferenceable, so it is not correct to allocate it as a member of another object. Wrap it in a BReference to avoid the problem. Fixes #11089.
This commit is contained in:
@@ -377,14 +377,18 @@ WindowArea::MoveToTopLayer(SATWindow* window)
|
|||||||
void
|
void
|
||||||
WindowArea::_UninitConstraints()
|
WindowArea::_UninitConstraints()
|
||||||
{
|
{
|
||||||
LinearSpec* linearSpec = fGroup->GetLinearSpec();
|
if (fGroup != NULL) {
|
||||||
|
LinearSpec* linearSpec = fGroup->GetLinearSpec();
|
||||||
|
|
||||||
linearSpec->RemoveConstraint(fMinWidthConstraint, true);
|
if (linearSpec != NULL) {
|
||||||
linearSpec->RemoveConstraint(fMinHeightConstraint, true);
|
linearSpec->RemoveConstraint(fMinWidthConstraint, true);
|
||||||
linearSpec->RemoveConstraint(fMaxWidthConstraint, true);
|
linearSpec->RemoveConstraint(fMinHeightConstraint, true);
|
||||||
linearSpec->RemoveConstraint(fMaxHeightConstraint, true);
|
linearSpec->RemoveConstraint(fMaxWidthConstraint, true);
|
||||||
linearSpec->RemoveConstraint(fWidthConstraint, true);
|
linearSpec->RemoveConstraint(fMaxHeightConstraint, true);
|
||||||
linearSpec->RemoveConstraint(fHeightConstraint, true);
|
linearSpec->RemoveConstraint(fWidthConstraint, true);
|
||||||
|
linearSpec->RemoveConstraint(fHeightConstraint, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fMinWidthConstraint = NULL;
|
fMinWidthConstraint = NULL;
|
||||||
fMinHeightConstraint = NULL;
|
fMinHeightConstraint = NULL;
|
||||||
@@ -787,6 +791,7 @@ Tab::CompareFunction(const Tab* tab1, const Tab* tab2)
|
|||||||
|
|
||||||
SATGroup::SATGroup()
|
SATGroup::SATGroup()
|
||||||
:
|
:
|
||||||
|
fLinearSpec(new(std::nothrow) LinearSpec(), true),
|
||||||
fHorizontalTabsSorted(false),
|
fHorizontalTabsSorted(false),
|
||||||
fVerticalTabsSorted(false),
|
fVerticalTabsSorted(false),
|
||||||
fActiveWindow(NULL)
|
fActiveWindow(NULL)
|
||||||
@@ -797,6 +802,8 @@ SATGroup::SATGroup()
|
|||||||
SATGroup::~SATGroup()
|
SATGroup::~SATGroup()
|
||||||
{
|
{
|
||||||
// Should be empty
|
// Should be empty
|
||||||
|
if (fSATWindowList.CountItems() > 0)
|
||||||
|
debugger("Deleting a SATGroup which is not empty");
|
||||||
//while (fSATWindowList.CountItems() > 0)
|
//while (fSATWindowList.CountItems() > 0)
|
||||||
// RemoveWindow(fSATWindowList.ItemAt(0));
|
// RemoveWindow(fSATWindowList.ItemAt(0));
|
||||||
}
|
}
|
||||||
@@ -1100,12 +1107,14 @@ SATGroup::ArchiveGroup(BMessage& archive)
|
|||||||
BReference<Tab>
|
BReference<Tab>
|
||||||
SATGroup::_AddHorizontalTab(float position)
|
SATGroup::_AddHorizontalTab(float position)
|
||||||
{
|
{
|
||||||
Variable* variable = fLinearSpec.AddVariable();
|
if (fLinearSpec == NULL)
|
||||||
if (!variable)
|
return NULL;
|
||||||
|
Variable* variable = fLinearSpec->AddVariable();
|
||||||
|
if (variable == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
Tab* tab = new (std::nothrow)Tab(this, variable, Tab::kHorizontal);
|
Tab* tab = new (std::nothrow)Tab(this, variable, Tab::kHorizontal);
|
||||||
if (!tab)
|
if (tab == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
BReference<Tab> tabRef(tab, true);
|
BReference<Tab> tabRef(tab, true);
|
||||||
|
|
||||||
@@ -1121,12 +1130,14 @@ SATGroup::_AddHorizontalTab(float position)
|
|||||||
BReference<Tab>
|
BReference<Tab>
|
||||||
SATGroup::_AddVerticalTab(float position)
|
SATGroup::_AddVerticalTab(float position)
|
||||||
{
|
{
|
||||||
Variable* variable = fLinearSpec.AddVariable();
|
if (fLinearSpec == NULL)
|
||||||
if (!variable)
|
return NULL;
|
||||||
|
Variable* variable = fLinearSpec->AddVariable();
|
||||||
|
if (variable == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
Tab* tab = new (std::nothrow)Tab(this, variable, Tab::kVertical);
|
Tab* tab = new (std::nothrow)Tab(this, variable, Tab::kVertical);
|
||||||
if (!tab)
|
if (tab == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
BReference<Tab> tabRef(tab, true);
|
BReference<Tab> tabRef(tab, true);
|
||||||
|
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ public:
|
|||||||
SATGroup();
|
SATGroup();
|
||||||
~SATGroup();
|
~SATGroup();
|
||||||
|
|
||||||
LinearSpec* GetLinearSpec() { return &fLinearSpec; }
|
LinearSpec* GetLinearSpec() { return fLinearSpec.Get(); }
|
||||||
|
|
||||||
/*! Create a new WindowArea from the crossing and add the window. */
|
/*! Create a new WindowArea from the crossing and add the window. */
|
||||||
bool AddWindow(SATWindow* window, Tab* left,
|
bool AddWindow(SATWindow* window, Tab* left,
|
||||||
@@ -321,7 +321,7 @@ protected:
|
|||||||
WindowAreaList fWindowAreaList;
|
WindowAreaList fWindowAreaList;
|
||||||
SATWindowList fSATWindowList;
|
SATWindowList fSATWindowList;
|
||||||
|
|
||||||
LinearSpec fLinearSpec;
|
BReference<LinearSpec> fLinearSpec;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TabList fHorizontalTabs;
|
TabList fHorizontalTabs;
|
||||||
|
|||||||
Reference in New Issue
Block a user