Skip to content
Snippets Groups Projects
Commit 0b1e2d59 authored by Michael Brüning's avatar Michael Brüning Committed by Jocelyn Turcotte
Browse files

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: default avatarJocelyn Turcotte <jocelyn.turcotte@digia.com>
parent e026171a
No related merge requests found
......@@ -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);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment