diff -r 9ce9496427f2 -r a0a0d581309b src/documentloader.cpp --- a/src/documentloader.cpp Sat Jan 28 17:47:06 2017 +0200 +++ b/src/documentloader.cpp Sun Jan 29 15:05:14 2017 +0200 @@ -23,8 +23,9 @@ #include "mainwindow.h" #include "dialogs/openprogressdialog.h" -DocumentLoader::DocumentLoader (bool onForeground, QObject *parent) : +DocumentLoader::DocumentLoader (Model* model, bool onForeground, QObject *parent) : QObject (parent), + _model(model), m_warningCount (0), m_isDone (false), m_hasAborted (false), @@ -55,9 +56,9 @@ return m_isOnForeground; } -const LDObjectList& DocumentLoader::objects() const +const QVector& DocumentLoader::objects() const { - return m_objects; + return _model->objects(); } void DocumentLoader::read (QIODevice* fp) @@ -98,10 +99,6 @@ // User wishes to abort, so stop here now. if (hasAborted()) { - for (LDObject* obj : m_objects) - obj->destroy(); - - m_objects.clear(); m_isDone = true; return; } @@ -126,7 +123,7 @@ ++m_warningCount; } - m_objects << obj; + _model->addObject(obj); } m_progress = i;