From f3d17dd6e77c297543868ad67f009cc01116ac39 Mon Sep 17 00:00:00 2001
From: Robin Burchell <robin.burchell@theqtcompany.com>
Date: Mon, 5 Jan 2015 16:36:52 +0100
Subject: [PATCH] UIDelegatesManager: Always print errors if component loading
 fails.

This setting is useful when developing a new UI set, and one may not initially
know about the suppression of errors, which is a painful problem to run into.

Furthermore, make sure to delete the failed component so that subsequent
attempted use of it doesn't succeed if UI_DELEGATES_DEBUG isn't enabled.

Change-Id: I3d2abc19fb4a007d06795d2e8149ae78d7c9c020
Reviewed-by: Pierre Rossi <pierre.rossi@theqtcompany.com>
---
 src/webengine/ui_delegates_manager.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp
index 95e04d699..637f3ea36 100644
--- a/src/webengine/ui_delegates_manager.cpp
+++ b/src/webengine/ui_delegates_manager.cpp
@@ -173,10 +173,10 @@ bool UIDelegatesManager::ensureComponentLoaded(ComponentType type)
     *component = (new QQmlComponent(engine, QUrl::fromLocalFile(fi.absoluteFilePath()), QQmlComponent::PreferSynchronous, m_view));
 
     if ((*component)->status() != QQmlComponent::Ready) {
-#ifdef UI_DELEGATES_DEBUG
         Q_FOREACH (const QQmlError& err, (*component)->errors())
-            fprintf(stderr, "  component error: %s\n", qPrintable(err.toString()));
-#endif
+            qWarning("QtWebEngine: component error: %s\n", qPrintable(err.toString()));
+        delete *component;
+        *component = 0;
         return false;
     }
     return true;
-- 
GitLab