aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/debugger/qqmldebugtranslationservice
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-05-02 09:06:43 +0200
committerUlf Hermann <ulf.hermann@qt.io>2022-05-02 21:58:59 +0200
commit3a4b6b9ba212943e3f8ab3261493ae5a4eaf8dfd (patch)
treeba1a5306f210a7f36da3653f74d9ad954d8ad910 /tests/auto/qml/debugger/qqmldebugtranslationservice
parentfce525fc789d4835476be6f42df16edfa7aec270 (diff)
tst_qqmldebugtranslationservice: Avoid memory leaks
Change-Id: Ib2b7a70fa015a298362cc56bb3da2819aeedd33c Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Diffstat (limited to 'tests/auto/qml/debugger/qqmldebugtranslationservice')
-rw-r--r--tests/auto/qml/debugger/qqmldebugtranslationservice/tst_qqmldebugtranslationservice.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/auto/qml/debugger/qqmldebugtranslationservice/tst_qqmldebugtranslationservice.cpp b/tests/auto/qml/debugger/qqmldebugtranslationservice/tst_qqmldebugtranslationservice.cpp
index 7519dd3043..7d22c3e48b 100644
--- a/tests/auto/qml/debugger/qqmldebugtranslationservice/tst_qqmldebugtranslationservice.cpp
+++ b/tests/auto/qml/debugger/qqmldebugtranslationservice/tst_qqmldebugtranslationservice.cpp
@@ -359,15 +359,16 @@ private:
int main(int argc, char *argv[])
{
- char **argv2 = new char *[argc + 2];
+ QVector<char *> argv2(argc + 2);
for (int i = 0; i < argc; ++i)
argv2[i] = argv[i];
- argv2[argc] = qstrdup(qPrintable(QString("-qmljsdebugger=native,services:%1")
- .arg(QQmlDebugTranslationServiceImpl::s_key)));
- ++argc;
- argv2[argc] = nullptr;
- QGuiApplication app(argc, argv2);
+ QByteArray debuggerArg = QStringLiteral("-qmljsdebugger=native,services:%1")
+ .arg(QQmlDebugTranslationServiceImpl::s_key).toUtf8();
+ argv2[argc] = debuggerArg.data();
+ argv2[++argc] = nullptr;
+
+ QGuiApplication app(argc, argv2.data());
app.setAttribute(Qt::AA_Use96Dpi, true); \
tst_QQmlDebugTranslationService tc; \
QTEST_SET_MAIN_SOURCE_PATH \