Return method GarbageCollector.
--HG-- branch : feature
This commit is contained in:
parent
bc545db1dc
commit
154c2c0708
|
@ -152,7 +152,6 @@ protected:
|
|||
*/
|
||||
VContainer *data;
|
||||
void setTagText(const QString &tag, const QString &text);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(VDomDocument)
|
||||
/**
|
||||
|
|
|
@ -639,6 +639,7 @@ bool VPattern::SaveDocument(const QString &fileName)
|
|||
e.CriticalMessageBox(tr("Error no unique id."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return VDomDocument::SaveDocument(fileName);
|
||||
}
|
||||
|
||||
|
@ -1865,7 +1866,28 @@ void VPattern::UpdateMeasurements()
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPattern::GarbageCollector()
|
||||
{
|
||||
QHashIterator<quint32, VDataTool*> t(tools);
|
||||
while (t.hasNext()) {
|
||||
t.next();
|
||||
VDataTool *tool = t.value();
|
||||
if(tool->referens() <= 0){
|
||||
QDomElement domElement = elementById(QString().setNum(t.key()));
|
||||
if(domElement.isElement()){
|
||||
QDomNode parent = domElement.parentNode();
|
||||
if(!parent.isNull()){
|
||||
parent.removeChild(domElement);
|
||||
} else {
|
||||
qWarning()<<tr("Can't get parent for object id = %1").arg(t.key());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QDomElement VPattern::GetPPElement(const QString &name)
|
||||
{
|
||||
if (name.isEmpty() == false)
|
||||
|
|
|
@ -197,6 +197,7 @@ private:
|
|||
void CollectId(const QDomElement &node, QVector<quint32> &vector)const;
|
||||
void PrepareForParse(const Document &parse);
|
||||
void UpdateMeasurements();
|
||||
void GarbageCollector();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue
Block a user