summaryrefslogtreecommitdiffstats
path: root/src/core/web_engine_library_info.cpp
diff options
context:
space:
mode:
authorMichael BrĂ¼ning <michael.bruning@theqtcompany.com>2015-01-14 17:42:12 +0100
committerJocelyn Turcotte <jocelyn.turcotte@digia.com>2015-01-15 11:44:39 +0100
commit0b1e2d59f7545b8ed175660389def694c7bf4506 (patch)
tree79896ea4fb502afce1471b376bf332d0cbbc93b1 /src/core/web_engine_library_info.cpp
parente026171af834c1a5db47f81d92432dd7d601b8dc (diff)
Use paths relative to QtWebEngineProcess on OS X.
Fixes crashes of the QtWebEngineProcess on OS X 10.7 that were caused by the bundle paths not being returned correctly. Change-Id: Ic839978a6f1bff361cb76a3468bf978a738b6e82 Task-number: QTBUG-43181 Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'src/core/web_engine_library_info.cpp')
-rw-r--r--src/core/web_engine_library_info.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp
index beae9dd75..2d72dd5a2 100644
--- a/src/core/web_engine_library_info.cpp
+++ b/src/core/web_engine_library_info.cpp
@@ -101,7 +101,12 @@ static inline CFBundleRef frameworkBundle()
static QString getPath(CFBundleRef frameworkBundle)
{
QString path;
- if (frameworkBundle) {
+ // The following is a fix for QtWebEngineProcess crashes on OS X 10.7 and before.
+ // We use it for the other OS X versions as well to make sure it works and because
+ // the directory structure should be the same.
+ if (qApp->applicationName() == QLatin1String(QTWEBENGINEPROCESS_NAME)) {
+ path = QDir::cleanPath(qApp->applicationDirPath() % QLatin1String("/../../../.."));
+ } else if (frameworkBundle) {
CFURLRef bundleUrl = CFBundleCopyBundleURL(frameworkBundle);
CFStringRef bundlePath = CFURLCopyFileSystemPath(bundleUrl, kCFURLPOSIXPathStyle);
path = QString::fromCFString(bundlePath);
@@ -114,7 +119,12 @@ static QString getPath(CFBundleRef frameworkBundle)
static QString getResourcesPath(CFBundleRef frameworkBundle)
{
QString path;
- if (frameworkBundle) {
+ // The following is a fix for QtWebEngineProcess crashes on OS X 10.7 and before.
+ // We use it for the other OS X versions as well to make sure it works and because
+ // the directory structure should be the same.
+ if (qApp->applicationName() == QLatin1String(QTWEBENGINEPROCESS_NAME)) {
+ path = getPath(frameworkBundle) % QLatin1String("/Resources");
+ } else if (frameworkBundle) {
CFURLRef resourcesRelativeUrl = CFBundleCopyResourcesDirectoryURL(frameworkBundle);
CFStringRef resourcesRelativePath = CFURLCopyFileSystemPath(resourcesRelativeUrl, kCFURLPOSIXPathStyle);
path = getPath(frameworkBundle) % QLatin1Char('/') % QString::fromCFString(resourcesRelativePath);