From 56608178501a6a594d50f0cf7f79eae9dbd75bbe Mon Sep 17 00:00:00 2001 From: Alexander Bruy Date: Tue, 26 May 2020 11:58:17 +0300 Subject: [PATCH 1/3] quote project file path when passing it to the crash handler to avoid issues if path contains spaces (fix #25532) --- src/app/qgscrashhandler.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app/qgscrashhandler.cpp b/src/app/qgscrashhandler.cpp index 55235ef3155a..983ff588cb70 100644 --- a/src/app/qgscrashhandler.cpp +++ b/src/app/qgscrashhandler.cpp @@ -59,7 +59,12 @@ LONG WINAPI QgsCrashHandler::handle( LPEXCEPTION_POINTERS exception ) arguments = QCoreApplication::arguments(); // TODO In future this needs to be moved out into a "session state" file because we can't trust this is valid in // a crash. - arguments << QgsProject::instance()->fileName(); + QString projectFile = QgsProject::instance()->fileName(); + if ( !projectFile.isEmpty() ) + // quote project file path to avoid issues if it has spaces + arguments << '"' << projectFile << '"'; + else + arguments << projectFile; QStringList reportData; reportData.append( QStringLiteral( "QGIS Version: %1" ).arg( Qgis::version() ) ); From dedae85c1fcd2eb121fbc3ea9a20ff8389bdea24 Mon Sep 17 00:00:00 2001 From: Alexander Bruy Date: Tue, 26 May 2020 12:34:41 +0300 Subject: [PATCH 2/3] fix list population --- src/app/qgscrashhandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/qgscrashhandler.cpp b/src/app/qgscrashhandler.cpp index 983ff588cb70..32008a16c90f 100644 --- a/src/app/qgscrashhandler.cpp +++ b/src/app/qgscrashhandler.cpp @@ -62,7 +62,7 @@ LONG WINAPI QgsCrashHandler::handle( LPEXCEPTION_POINTERS exception ) QString projectFile = QgsProject::instance()->fileName(); if ( !projectFile.isEmpty() ) // quote project file path to avoid issues if it has spaces - arguments << '"' << projectFile << '"'; + arguments << QStringLiteral( "\"%1\"" ).arg( projectFile ); else arguments << projectFile; From 32590e1f59d61378e19c7ba59a1d10dce38d7f66 Mon Sep 17 00:00:00 2001 From: Alexander Bruy Date: Tue, 26 May 2020 12:36:24 +0300 Subject: [PATCH 3/3] don't append empty string --- src/app/qgscrashhandler.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/app/qgscrashhandler.cpp b/src/app/qgscrashhandler.cpp index 32008a16c90f..a606dbe413fb 100644 --- a/src/app/qgscrashhandler.cpp +++ b/src/app/qgscrashhandler.cpp @@ -63,8 +63,6 @@ LONG WINAPI QgsCrashHandler::handle( LPEXCEPTION_POINTERS exception ) if ( !projectFile.isEmpty() ) // quote project file path to avoid issues if it has spaces arguments << QStringLiteral( "\"%1\"" ).arg( projectFile ); - else - arguments << projectFile; QStringList reportData; reportData.append( QStringLiteral( "QGIS Version: %1" ).arg( Qgis::version() ) );