aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@theqtcompany.com>2015-05-07 12:10:18 +0200
committerEike Ziller <eike.ziller@theqtcompany.com>2015-05-12 05:08:18 +0000
commit9724cf6891f7b2812713c89dc89782ca5ad60314 (patch)
tree5f75023035f71c0361c2d2750a975458cb1869e0 /src
parent19200258ae047cb1d77b9ed55ad684d3306cfaae (diff)
Help: Work around issue with Visual Studio < 2013
Visual Studio before 2013 had bugs in bool conversion of std::function, leading to "true" in some cases where it shouldn't. Task-number: QTCREATORBUG-14399 Change-Id: I8a1ad2f952247049355e11337ddf99f380ebde98 Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/help/helpplugin.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp
index d03a2dfe1e..6079eb8b60 100644
--- a/src/plugins/help/helpplugin.cpp
+++ b/src/plugins/help/helpplugin.cpp
@@ -369,24 +369,37 @@ HelpViewer *HelpPlugin::createHelpViewer(qreal zoom)
factories.insert(QLatin1String("textbrowser"), []() { return new TextBrowserHelpViewer(); });
ViewerFactory factory;
+ // TODO: Visual Studio < 2013 has a bug in std::function's operator bool, which in this case
+ // leads to succeeding boolean checks on factory which should not succeed.
+ // So we may not check against "if (!factory)"
+ bool factoryFound = false;
+
// check requested backend
const QString backend = QLatin1String(qgetenv("QTC_HELPVIEWER_BACKEND"));
if (!backend.isEmpty()) {
- factory = factories.value(backend);
- if (!factory)
+ if (!factories.contains(backend)) {
qWarning("Help viewer backend \"%s\" not found, using default.", qPrintable(backend));
+ } else {
+ factory = factories.value(backend);
+ factoryFound = true;
+ }
}
// default setting
#ifdef QTC_MAC_NATIVE_HELPVIEWER_DEFAULT
- if (!factory)
+ if (!factoryFound && factories.contains(QLatin1String("native"))) {
factory = factories.value(QLatin1String("native"));
+ factoryFound = true;
+ }
#endif
- if (!factory)
+ if (!factoryFound && factories.contains(QLatin1String("qtwebkit"))) {
factory = factories.value(QLatin1String("qtwebkit"));
- if (!factory)
+ factoryFound = true;
+ }
+ if (!factoryFound && factories.contains(QLatin1String("textbrowser"))) {
factory = factories.value(QLatin1String("textbrowser"));
-
- QTC_ASSERT(factory, return 0);
+ factoryFound = true;
+ }
+ QTC_ASSERT(factoryFound, return 0);
HelpViewer *viewer = factory();
// initialize font