mirror of
https://github.com/leozide/leocad
synced 2025-01-17 18:11:42 +01:00
Fixed small leak merging files. Fixes #276.
This commit is contained in:
parent
b77b9aac5c
commit
8f04ccbec7
2 changed files with 5 additions and 6 deletions
|
@ -938,7 +938,7 @@ void lcMainWindow::ProjectFileChanged(const QString& Path)
|
|||
{
|
||||
PieceInfo* Info = lcGetPiecesLibrary()->FindPiece(FileInfo.fileName().toLatin1(), CurrentProject, false, true);
|
||||
|
||||
if (Info)
|
||||
if (Info && Info->IsProject())
|
||||
Info->GetProject()->Load(Path);
|
||||
}
|
||||
}
|
||||
|
@ -2211,10 +2211,9 @@ void lcMainWindow::MergeProject()
|
|||
UpdateModels();
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::information(this, tr("LeoCAD"), tr("Error loading '%1'.").arg(LoadFileName));
|
||||
delete NewProject;
|
||||
}
|
||||
|
||||
delete NewProject;
|
||||
}
|
||||
|
||||
void lcMainWindow::ImportLDD()
|
||||
|
|
|
@ -494,9 +494,8 @@ bool Project::Save(QTextStream& Stream)
|
|||
|
||||
void Project::Merge(Project* Other)
|
||||
{
|
||||
for (int ModelIdx = 0; ModelIdx < Other->mModels.GetSize(); ModelIdx++)
|
||||
for (lcModel* Model : Other->mModels)
|
||||
{
|
||||
lcModel* Model = Other->mModels[ModelIdx];
|
||||
QString Name = Model->GetProperties().mName;
|
||||
|
||||
for (;;)
|
||||
|
@ -522,6 +521,7 @@ void Project::Merge(Project* Other)
|
|||
mModels.Add(Model);
|
||||
}
|
||||
|
||||
Other->mModels.RemoveAll();
|
||||
mModified = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue