feat(src/app/object-builders/AsyncObjectBuilder): add assertions

This commit is contained in:
Ronan Abhamon 2017-03-28 11:32:32 +02:00
parent e63f9708f5
commit 0fb12cf952

View file

@ -33,11 +33,12 @@ using namespace std;
class AsyncObjectBuilder::ObjectIncubator : public QQmlIncubator {
public:
// FIXME: At this moment, asynchronous loading is unstable.
// Use `IncubationMode::Synchronous` instead in Qt 5.9.
// In the future, use `IncubationMode::Asynchronous` instead in Qt 5.9.
//
// See: https://bugreports.qt.io/browse/QTBUG-49416 and
// https://bugreports.qt.io/browse/QTBUG-50992
ObjectIncubator (AsyncObjectBuilder *builder) : QQmlIncubator(IncubationMode::Synchronous) {
Q_ASSERT(builder != nullptr);
m_builder = builder;
}
@ -63,6 +64,9 @@ protected:
m_builder->m_object = object;
emit m_builder->objectCreated(object);
Q_ASSERT(m_builder->m_component != nullptr);
Q_ASSERT(m_builder->m_incubator != nullptr);
// Optimization: Delete unused component now.
m_builder->m_component->deleteLater();