Use BReferenceable properties of LinearSpec in BALMLayout.
This saves us from a potential use-afte-free bug.
This commit is contained in:
parent
7c3800078e
commit
f9cabdd009
|
@ -170,7 +170,6 @@ private:
|
||||||
bool _TrySolve();
|
bool _TrySolve();
|
||||||
|
|
||||||
LinearProgramming::LinearSpec* fSolver;
|
LinearProgramming::LinearSpec* fSolver;
|
||||||
LinearProgramming::LinearSpec fOwnSolver;
|
|
||||||
|
|
||||||
BReference<XTab> fLeft;
|
BReference<XTab> fLeft;
|
||||||
BReference<XTab> fRight;
|
BReference<XTab> fRight;
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
|
|
||||||
#include <ControlLook.h>
|
#include <ControlLook.h>
|
||||||
|
|
||||||
#include "ALMGroup.h"
|
|
||||||
#include "RowColumnManager.h"
|
#include "RowColumnManager.h"
|
||||||
#include "ViewLayoutItem.h"
|
#include "ViewLayoutItem.h"
|
||||||
|
|
||||||
|
@ -61,7 +60,8 @@ BALMLayout::BALMLayout(float hSpacing, float vSpacing, BALMLayout* friendLayout)
|
||||||
fVSpacing(BControlLook::ComposeSpacing(vSpacing)),
|
fVSpacing(BControlLook::ComposeSpacing(vSpacing)),
|
||||||
fBadLayoutPolicy(new DefaultPolicy())
|
fBadLayoutPolicy(new DefaultPolicy())
|
||||||
{
|
{
|
||||||
fSolver = friendLayout ? friendLayout->Solver() : &fOwnSolver;
|
fSolver = friendLayout ? friendLayout->Solver() : new LinearSpec();
|
||||||
|
fSolver->AcquireReference();
|
||||||
fRowColumnManager = new RowColumnManager(fSolver);
|
fRowColumnManager = new RowColumnManager(fSolver);
|
||||||
|
|
||||||
fLeft = AddXTab();
|
fLeft = AddXTab();
|
||||||
|
@ -86,6 +86,7 @@ BALMLayout::~BALMLayout()
|
||||||
{
|
{
|
||||||
delete fRowColumnManager;
|
delete fRowColumnManager;
|
||||||
delete fBadLayoutPolicy;
|
delete fBadLayoutPolicy;
|
||||||
|
fSolver->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue