From 6cb052e79b3d024791155e44f7c888baac923e84 Mon Sep 17 00:00:00 2001 From: Anmol Gautam Date: Fri, 22 Jun 2018 19:39:41 +0530 Subject: [PATCH] Fix when QQmlComponent throws error while init plugin --- src/lib/plugins/plugins.cpp | 2 +- src/lib/plugins/qml/qmlpluginloader.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib/plugins/plugins.cpp b/src/lib/plugins/plugins.cpp index 907360e19..405f7602e 100644 --- a/src/lib/plugins/plugins.cpp +++ b/src/lib/plugins/plugins.cpp @@ -474,7 +474,7 @@ void Plugins::initQmlPlugin(Plugin *plugin) plugin->qmlPluginLoader->createComponent(); if (!plugin->qmlPluginLoader->instance()) { - qWarning() << "Initializing" << name << "failed:" << plugin->qmlPluginLoader->component()->errorString(); + qWarning().noquote() << "Falied to create component for" << name << "plugin:" << plugin->qmlPluginLoader->component()->errorString(); return; } diff --git a/src/lib/plugins/qml/qmlpluginloader.cpp b/src/lib/plugins/qml/qmlpluginloader.cpp index 6a64b8460..dd22c8193 100644 --- a/src/lib/plugins/qml/qmlpluginloader.cpp +++ b/src/lib/plugins/qml/qmlpluginloader.cpp @@ -27,6 +27,11 @@ QmlPluginLoader::QmlPluginLoader(const QString &path) void QmlPluginLoader::createComponent() { m_interface = qobject_cast(m_component->create()); + + if (!m_interface) { + return; + } + m_interface->setEngine(m_engine); connect(m_interface, &QmlPluginInterface::qmlPluginUnloaded, this, [this]{ delete m_component;