Collect garbage only after successfully parse. This way wrongly accused items
have one more time to restore a reference. --HG-- branch : develop
This commit is contained in:
parent
56780fa337
commit
1158b06425
|
@ -4626,6 +4626,9 @@ bool MainWindow::LoadPattern(QString fileName, const QString& customMeasureFile)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FullParseFile();
|
FullParseFile();
|
||||||
|
/* Collect garbage only after successfully parse. This way wrongly accused items have one more time to restore
|
||||||
|
* a reference. */
|
||||||
|
doc->GarbageCollector(true);
|
||||||
|
|
||||||
m_progressBar->setVisible(false);
|
m_progressBar->setVisible(false);
|
||||||
#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||||
|
|
|
@ -3343,8 +3343,10 @@ QDomElement VPattern::FindIncrement(const QString &name) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPattern::GarbageCollector()
|
void VPattern::GarbageCollector(bool commit)
|
||||||
{
|
{
|
||||||
|
bool cleared = false;
|
||||||
|
|
||||||
QDomNodeList modelingList = elementsByTagName(TagModeling);
|
QDomNodeList modelingList = elementsByTagName(TagModeling);
|
||||||
for (int i=0; i < modelingList.size(); ++i)
|
for (int i=0; i < modelingList.size(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -3366,7 +3368,11 @@ void VPattern::GarbageCollector()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Parent was deleted. We do not need this object anymore
|
{ // Parent was deleted. We do not need this object anymore
|
||||||
modElement.removeChild(modNode);
|
if (commit)
|
||||||
|
{
|
||||||
|
modElement.removeChild(modNode);
|
||||||
|
cleared = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3378,6 +3384,11 @@ void VPattern::GarbageCollector()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cleared)
|
||||||
|
{
|
||||||
|
RefreshElementIdCache();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -53,6 +53,8 @@ public:
|
||||||
|
|
||||||
void Parse(const Document &parse);
|
void Parse(const Document &parse);
|
||||||
|
|
||||||
|
void GarbageCollector(bool commit = false);
|
||||||
|
|
||||||
void setCurrentData();
|
void setCurrentData();
|
||||||
virtual void UpdateToolData(const quint32 &id, VContainer *data) Q_DECL_OVERRIDE;
|
virtual void UpdateToolData(const quint32 &id, VContainer *data) Q_DECL_OVERRIDE;
|
||||||
VContainer GetCompleteData() const;
|
VContainer GetCompleteData() const;
|
||||||
|
@ -235,8 +237,6 @@ private:
|
||||||
QDomElement MakeEmptyIncrement(const QString &name);
|
QDomElement MakeEmptyIncrement(const QString &name);
|
||||||
QDomElement FindIncrement(const QString &name) const;
|
QDomElement FindIncrement(const QString &name) const;
|
||||||
|
|
||||||
void GarbageCollector();
|
|
||||||
|
|
||||||
void NewEmptyIncrement(const QString &type, const QString &name);
|
void NewEmptyIncrement(const QString &type, const QString &name);
|
||||||
void NewEmptyIncrementAfter(const QString &type, const QString &after, const QString &name);
|
void NewEmptyIncrementAfter(const QString &type, const QString &after, const QString &name);
|
||||||
void RemoveIncrement(const QString &type, const QString &name);
|
void RemoveIncrement(const QString &type, const QString &name);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user