Disallow QQmlDebugServer::enable for QT_QML_NO_DEBUGGER
authorUlf Hermann <ulf.hermann@theqtcompany.com>
Fri, 12 Dec 2014 13:53:09 +0000 (14:53 +0100)
committerUlf Hermann <ulf.hermann@theqtcompany.com>
Mon, 12 Jan 2015 10:38:27 +0000 (11:38 +0100)
This mirrors the behavior of the QQmlDebugServer constructor.
Unfortunately we have two #defines to disable the debug server,
QT_QML_NO_DEBUGGER and QQML_NO_DEBUG_PROTOCOL. We should honor both of
them as people might rely on either of them to effectively prevent the
debug server from working.

Change-Id: I0bc0d48632eaa05c471d0afed6fc48436116746a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
src/qml/debugger/qqmldebugserver.cpp

index 9715b5c..e85929a 100644 (file)
@@ -732,6 +732,7 @@ void QQmlDebugServer::sendMessages(QQmlDebugService *service,
 
 bool QQmlDebugServer::enable(int portFrom, int portTo, bool block, const QString &hostAddress)
 {
+#ifndef QT_QML_NO_DEBUGGER
     QQmlDebugServerInstanceWrapper *wrapper = debugServerInstance();
     if (!wrapper)
         return false;
@@ -745,6 +746,13 @@ bool QQmlDebugServer::enable(int portFrom, int portTo, bool block, const QString
             return false;
     }
     return true;
+#else
+    Q_UNUSED(portFrom);
+    Q_UNUSED(portTo);
+    Q_UNUSED(block);
+    Q_UNUSED(hostAddress);
+    return false;
+#endif
 }
 
 void QQmlDebugServer::wakeEngine(QQmlEngine *engine)