Memory leak fixes from Till Busch
This commit is contained in:
parent
d15229a835
commit
1b439f8501
4 changed files with 22 additions and 24 deletions
|
@ -818,17 +818,13 @@ bool FGXMLAutopilot::build() {
|
||||||
string name = node->getName();
|
string name = node->getName();
|
||||||
// cout << name << endl;
|
// cout << name << endl;
|
||||||
if ( name == "pid-controller" ) {
|
if ( name == "pid-controller" ) {
|
||||||
FGXMLAutoComponent *c = new FGPIDController( node );
|
components.push_back( new FGPIDController( node ) );
|
||||||
components.push_back( c );
|
|
||||||
} else if ( name == "pi-simple-controller" ) {
|
} else if ( name == "pi-simple-controller" ) {
|
||||||
FGXMLAutoComponent *c = new FGPISimpleController( node );
|
components.push_back( new FGPISimpleController( node ) );
|
||||||
components.push_back( c );
|
|
||||||
} else if ( name == "predict-simple" ) {
|
} else if ( name == "predict-simple" ) {
|
||||||
FGXMLAutoComponent *c = new FGPredictor( node );
|
components.push_back( new FGPredictor( node ) );
|
||||||
components.push_back( c );
|
|
||||||
} else if ( name == "filter" ) {
|
} else if ( name == "filter" ) {
|
||||||
FGXMLAutoComponent *c = new FGDigitalFilter( node );
|
components.push_back( new FGDigitalFilter( node ) );
|
||||||
components.push_back( c );
|
|
||||||
} else {
|
} else {
|
||||||
SG_LOG( SG_ALL, SG_ALERT, "Unknown top level section: "
|
SG_LOG( SG_ALL, SG_ALERT, "Unknown top level section: "
|
||||||
<< name );
|
<< name );
|
||||||
|
|
|
@ -52,7 +52,7 @@ SG_USING_STD(deque);
|
||||||
* Base class for other autopilot components
|
* Base class for other autopilot components
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class FGXMLAutoComponent {
|
class FGXMLAutoComponent : public SGReferenced {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
typedef vector<FGXMLAutoComponent *> comp_list;
|
typedef vector<SGSharedPtr<FGXMLAutoComponent> > comp_list;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -813,11 +813,11 @@ FGDialog::setColor(puObject * object, SGPropertyNode * props, int which)
|
||||||
if (type == "textbox" && props->getBoolValue("editable"))
|
if (type == "textbox" && props->getBoolValue("editable"))
|
||||||
type += "-editable";
|
type += "-editable";
|
||||||
|
|
||||||
FGColor *c = new FGColor(_gui->getColor("background"));
|
FGColor c(_gui->getColor("background"));
|
||||||
c->merge(_gui->getColor(type));
|
c.merge(_gui->getColor(type));
|
||||||
c->merge(props->getNode("color"));
|
c.merge(props->getNode("color"));
|
||||||
if (c->isValid())
|
if (c.isValid())
|
||||||
object->setColourScheme(c->red(), c->green(), c->blue(), c->alpha());
|
object->setColourScheme(c.red(), c.green(), c.blue(), c.alpha());
|
||||||
|
|
||||||
const struct {
|
const struct {
|
||||||
int mask;
|
int mask;
|
||||||
|
@ -840,20 +840,20 @@ FGDialog::setColor(puObject * object, SGPropertyNode * props, int which)
|
||||||
|
|
||||||
for (int i = 0; i < numcol; i++) {
|
for (int i = 0; i < numcol; i++) {
|
||||||
bool dirty = false;
|
bool dirty = false;
|
||||||
c->clear();
|
c.clear();
|
||||||
c->setAlpha(1.0);
|
c.setAlpha(1.0);
|
||||||
|
|
||||||
dirty |= c->merge(_gui->getColor(type + '-' + pucol[i].name));
|
dirty |= c.merge(_gui->getColor(type + '-' + pucol[i].name));
|
||||||
if (which & pucol[i].mask)
|
if (which & pucol[i].mask)
|
||||||
dirty |= c->merge(props->getNode("color"));
|
dirty |= c.merge(props->getNode("color"));
|
||||||
|
|
||||||
if ((pucol[i].mask == LABEL) && !c->isValid())
|
if ((pucol[i].mask == LABEL) && !c.isValid())
|
||||||
dirty |= c->merge(_gui->getColor("label"));
|
dirty |= c.merge(_gui->getColor("label"));
|
||||||
|
|
||||||
dirty |= c->merge(props->getNode(pucol[i].cname));
|
dirty |= c.merge(props->getNode(pucol[i].cname));
|
||||||
|
|
||||||
if (c->isValid() && dirty)
|
if (c.isValid() && dirty)
|
||||||
object->setColor(pucol[i].id, c->red(), c->green(), c->blue(), c->alpha());
|
object->setColor(pucol[i].id, c.red(), c.green(), c.blue(), c.alpha());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1124,6 +1124,8 @@ FGInput::mouse_mode::~mouse_mode ()
|
||||||
FGInput::mouse::mouse ()
|
FGInput::mouse::mouse ()
|
||||||
: x(-1),
|
: x(-1),
|
||||||
y(-1),
|
y(-1),
|
||||||
|
save_x(-1),
|
||||||
|
save_y(-1),
|
||||||
nModes(1),
|
nModes(1),
|
||||||
current_mode(0),
|
current_mode(0),
|
||||||
modes(0)
|
modes(0)
|
||||||
|
|
Loading…
Reference in a new issue