From 50a1efcb170f4df0f4602805b7a07b80798d68ab Mon Sep 17 00:00:00 2001
From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Date: Tue, 1 Aug 2017 09:23:45 +0200
Subject: [PATCH] Fix crash regression when using
 ANDROID_DEPLOYMENT_DEPENDENCIES

Change 919d07e6809a6705941a9819ba145062a947fa39 introduced a
splitRef() on a temporary string, which will cause dangling pointers
as documented. This caused crashes for everyone using
ANDROID_DEPLOYMENT_DEPENDENCIES.

[ChangeLog][androiddeployqt] Fixed a crash when using
ANDROID_DEPLOYMENT_DEPENDENCIES to specify the files to deploy.

Task-number: QTBUG-61636
Change-Id: I16dc84f76667e9b8af5edf79d7c6498657176247
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
---
 src/androiddeployqt/main.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/androiddeployqt/main.cpp b/src/androiddeployqt/main.cpp
index dd5b74bd6..51b514f51 100644
--- a/src/androiddeployqt/main.cpp
+++ b/src/androiddeployqt/main.cpp
@@ -774,7 +774,8 @@ bool readInputFile(Options *options)
     {
         const QJsonValue deploymentDependencies = jsonObject.value(QStringLiteral("deployment-dependencies"));
         if (!deploymentDependencies.isUndefined()) {
-            const auto dependencies = deploymentDependencies.toString().splitRef(QLatin1Char(','));
+            QString deploymentDependenciesString = deploymentDependencies.toString();
+            const auto dependencies = deploymentDependenciesString.splitRef(QLatin1Char(','));
             for (const QStringRef &dependency : dependencies) {
                 QString path = options->qtInstallDirectory + QLatin1Char('/') + dependency;
                 if (QFileInfo(path).isDir()) {
-- 
GitLab