Make it possible to have a Variable not belonging to any LinearSpec.
This commit is contained in:
@@ -93,6 +93,9 @@ LinearSpec::AddVariable(Variable* variable)
|
|||||||
if (!fVariables.AddItem(variable))
|
if (!fVariables.AddItem(variable))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (variable->fLS == NULL)
|
||||||
|
variable->fLS = this;
|
||||||
|
|
||||||
if (!fSolver->VariableAdded(variable)) {
|
if (!fSolver->VariableAdded(variable)) {
|
||||||
fVariables.RemoveItem(variable);
|
fVariables.RemoveItem(variable);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -325,6 +325,7 @@ Variable::RemoveReference()
|
|||||||
*/
|
*/
|
||||||
Variable::~Variable()
|
Variable::~Variable()
|
||||||
{
|
{
|
||||||
fLS->RemoveVariable(this, false);
|
if (fLS)
|
||||||
|
fLS->RemoveVariable(this, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user