From 67fbdadb3ba1aa9f86ae2d6ca3bff69479fb12be Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Mon, 8 Oct 2018 15:13:50 +0200 Subject: Fix translation contexts for paths with drive letters on Windows Inside method_qtTr, the filename is assumed to be a (correct) URL. When a (normalized) path with a windows drive letter is passed to QJSEngine::evaluate, the URL will have a scheme that is the drive letter. We cannot correct this in method_qtTr, because at that point we might get in files that do not come from the file system, but through actual URLs. The place where we know for sure that the filename is a real file name and not a URL, is in QJSEngine::evaluate. So at that point, make sure that the filename is a valid URL. Task-number: QTBUG-70425 Change-Id: Ia41859c4024ac46e6f8c3d96057a5dffdecd8f56 Reviewed-by: Ulf Hermann --- src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp | 4 ++-- .../qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp index 3170ee0c1b..5521e7628b 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp @@ -157,7 +157,7 @@ void QV4Debugger::clearPauseRequest() QV4Debugger::ExecutionState QV4Debugger::currentExecutionState() const { ExecutionState state; - state.fileName = getFunction()->sourceFile(); + state.fileName = QUrl(getFunction()->sourceFile()).fileName(); state.lineNumber = engine()->currentStackFrame->lineNumber(); return state; @@ -288,7 +288,7 @@ void QV4Debugger::pauseAndWait(PauseReason reason) bool QV4Debugger::reallyHitTheBreakPoint(const QString &filename, int linenr) { QHash::iterator it = m_breakPoints.find( - BreakPoint(filename.mid(filename.lastIndexOf('/') + 1), linenr)); + BreakPoint(QUrl(filename).fileName(), linenr)); if (it == m_breakPoints.end()) return false; QString condition = it.value(); diff --git a/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp index ceaa8a8de1..a5c2f40420 100644 --- a/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp @@ -689,8 +689,7 @@ bool NativeDebugger::reallyHitTheBreakPoint(const QV4::Function *function, int l for (int i = 0, n = m_service->m_breakHandler->m_breakPoints.size(); i != n; ++i) { const BreakPoint &bp = m_service->m_breakHandler->m_breakPoints.at(i); if (bp.lineNumber == lineNumber) { - const QString fileName = function->sourceFile(); - const QStringRef base = fileName.midRef(fileName.lastIndexOf('/') + 1); + const QString base = QUrl(function->sourceFile()).fileName(); if (bp.fileName.endsWith(base)) { if (bp.condition.isEmpty() || checkCondition(bp.condition)) { BreakPoint &mbp = m_service->m_breakHandler->m_breakPoints[i]; -- cgit v1.2.3