diff options
author | Ulf Hermann <ulf.hermann@digia.com> | 2014-01-15 12:30:36 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-15 14:09:50 +0100 |
commit | 019598f57e892feacfb43b1095b3ccf5cec4d4ee (patch) | |
tree | d47d77404ddaae48aa59e03349191fee84facc19 /src | |
parent | 662046fe17c76d4fe505f0a04a66aa3477c14b32 (diff) |
Make sure that profiling can only be started if debugging is enabled.
Enabling the profiler doesn't make much sense if there is no debug
service as the messages can't be sent anywhere then. Furthermore, the
profiler instance is only properly initialized if debugging is enabled
and thus enabling profiling without debugging being enabled can cause
problems.
Change-Id: I784a110126d45a9a2bc9d9e14d9a22e2980c3a42
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/debugger/qqmlprofilerservice.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/v8/qqmlbuiltinfunctions.cpp | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/qml/debugger/qqmlprofilerservice.cpp b/src/qml/debugger/qqmlprofilerservice.cpp index 3c066bd380..af2aea21ae 100644 --- a/src/qml/debugger/qqmlprofilerservice.cpp +++ b/src/qml/debugger/qqmlprofilerservice.cpp @@ -178,7 +178,7 @@ void QQmlProfilerService::sendProfilingData() bool QQmlProfilerService::startProfilingImpl() { bool success = false; - if (!profilingEnabled()) { + if (QQmlDebugService::isDebuggingEnabled() && !profilingEnabled()) { setProfilingEnabled(true); sendStartedProfilingMessageImpl(); success = true; diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp index 0409b92e89..67b7e789bd 100644 --- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp +++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp @@ -1432,7 +1432,9 @@ QV4::ReturnedValue ConsoleObject::method_profile(CallContext *ctx) const QByteArray baSource = frame.source.toUtf8(); const QByteArray baFunction = frame.function.toUtf8(); QMessageLogger logger(baSource.constData(), frame.line, baFunction.constData()); - if (QQmlProfilerService::startProfiling()) { + if (!QQmlDebugService::isDebuggingEnabled()) { + logger.warning("Cannot start profiling because debug service is disabled. Start with -qmljsdebugger=port:XXXXX."); + } else if (QQmlProfilerService::startProfiling()) { QV8ProfilerService::instance()->startProfiling(title); logger.debug("Profiling started."); |